Skip to content

Tag Archives: Data Structures-Binary Search Trees

Consider the same code as given in above question. What does the function print() do in general? The function print() receives root of a Binary… Read More
Consider the following code snippet in C. The function print() receives root of a Binary Search Tree (BST) and a positive integer k as arguments.… Read More
Which of the following traversals is sufficient to construct BST from given traversals 1) Inorder 2) Preorder 3) Postorder (A) Any one of the given… Read More
Consider the following Binary Search Tree 10 / \ 5 20 / / \ 4 15 30 / 11 If we randomly search one of… Read More
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… Read More
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… Read More
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.… Read More
Which of the following traversal outputs the data in sorted order in a BST? (A) Preorder (B) Inorder (C) Postorder (D) Level order Answer: (B)… Read More
How many distinct binary search trees can be created out of 4 distinct keys? (A) 4 (B) 14 (C) 24 (D) 42 Answer: (B) Explanation:… Read More
We are given a set of n distinct elements and an unlabeled binary tree with n nodes. In how many ways can we populate the… Read More
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… Read More
What is the worst case time complexity for search, insert and delete operations in a general Binary Search Tree? (A) O(n) for all (B) O(Logn)… Read More