ECE 26400 - 001 Quiz 06

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Suppose T is a binary tree with 14 nodes. What is the minimum possible depth of T?

3

The following numbers are inserted into an empty binary search tree in the given order: 10, 1, 3, 5, 15, 12, 16. What is the height of the binary search tree ?

4

Look at the code snippet below select the correct option from the list TreeNode* root; if(root != NULL) { p = root->left; while(p != NULL) p = p->right; Node* res = p; }

After the end of the while loop "res" is NULL

Which of the following traversals is sufficient to construct BST from given traversals 1) Inorder 2) Preorder 3) Postorder

Either 2 or 3

Is this a binary search tree? 55 / \ 17 60 / \ / \ 5 20 42 105 / \ 3 9

FALSE

The children of a same parent node are called as

Siblings

In a binary search tree if we print the tree in inorder then which of the following is true?

The elements are printed in reverse sorted order if the binary search tree has elements on the left greater than the root

In delete operation of BST, we need inorder successor (or predecessor) of a node when the node to be deleted has both left and right child as non-empty. Which of the following is true about inorder successor needed in delete operation?

Inorder successor is always either a leaf node or a node with an empty left child

How many distinct binary search trees can be created out of 4 distinct keys?

14

The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42. Which one of the following is the postorder traversal sequence of the same tree?

15, 10, 23, 25, 20, 35, 42, 39, 30

int nBST(TreeNode *root) { return (root) ? (root->left || root->right) + nBST(root->left) + nBST(root->right) : 0; } This is how you are not supposed to write code unless you are writing obfuscated code. But what does the code do?

returns the number of internal nodes i.e a node which has at least one child

Suppose the numbers 7, 5, 1, 8, 3, 6, 0, 9, 4, 2 are inserted in that order into an initially empty binary search tree. The binary search tree uses the usual ordering on natural numbers. What is the post-order traversal sequence of the resultant tree?

0243165987

Which of the following statements about binary trees is NOT true?

Every binary tree has at least one node


Kaugnay na mga set ng pag-aaral

Managerial Accounting Final Work Through

View Set

Financial Accounting- Chapter 5: Receivables and Sales

View Set

Chapter 16: Toward a New Worldview

View Set

Chapter 2: Financial Aspects of Career Planning

View Set

AST Practice Bonus Exam #2 (part 4)

View Set

ATI Adult Medsurg Ch. 10- Multiple Sclerosis

View Set