Recent questions tagged binary-search-tree

1 1 vote
1 1 answer
648
648 views
Binary search tree contains the values $\text{1, 2, 3, 4, 5, 6, 7, 8}$. The tree is traversed in pre-order and the values are printed out. Which of the following sequence...
0 0 votes
2 answers 2 answers
1.3k
1.3k views
Suppose we have to insert the following sequence of keys into an empty binary search tree:$\text{5, 7, 45, 60, 50, 23, 15, 54}$What would be the height of binary search t...
1 1 vote
1 1 answer
670
670 views
When we perform in order traversal on a binary tree, we get the ascending order array. The tree is:Heap treealmost complete binary treeBinary search treeCannot be determi...
2 2 votes
1 1 answer
1.2k
1.2k views
You are given the postorder traversal, $P$, of a binary search tree on the $n$ elements $1,2,\dots,n.$ You have to determine the unique binary search tree that has $P$ as...
2 2 votes
1 1 answer
1.1k
1.1k views
A binary search tree contains the values-$1,2,3,4,5,6,7$ and $8.$ The tree is traversed in preorder and the values are printed out. Which of the following sequences is a ...
2 2 votes
2 2 answers
1.5k
1.5k views
In binary search tree which traversal is used for getting ascending order values ?InorderPreorderPostorderNone of the options
1 1 vote
3 3 answers
2.2k
2.2k views
If for a given Binary Search Tree (BST) the pre-order traversal is $41,23,11,31,62,50,73$. Then which of the following is its post-order traversal?$11,31,23,50,73,62,41$$...
0 0 votes
1 1 answer
939
939 views
Which traversal techniques lists the nodes of a binary search tree in ascending order?post – orderin – orderpre – orderlinear – order
2 2 votes
4 4 answers
6.8k
6.8k views
Which of the following statements is false?Optimal binary search tree construction can be performed efficiently using dynamic programming.Breadth-first search cannot be u...
23 23 votes
5 answers 5 answers
27.7k
27.7k views
The preorder traversal of a binary search tree is $15, 10, 12, 11, 20, 18, 16, 19$. Which one of the following is the postorder traversal of the tree?$10,11,12,15,16,18,1...
57 57 votes
6 answers 6 answers
41.7k
41.7k views
In a balanced binary search tree with $n$ elements, what is the worst case time complexity of reporting all elements in range $[a,b]$? Assume that the number of reported ...
5 5 votes
3 3 answers
4.3k
4.3k views
What is the in-order successor of $15$ in the given binary search tree?$18$$6$$17$$20$
1 1 vote
1 1 answer
2.2k
2.2k views
Argue that since sorting $n$ elements takes $\Omega (n\ lgn)$ time in the worst case in the comparison model, any comparison-based algorithm for constructing a $BST$ fro...
6 6 votes
4 4 answers
3.6k
3.6k views
Suppose that the figure to the right is a binary search tree. The letters indicate the names of the nodes, not the values that are stored. What is the predecessor node, i...
1 1 vote
1 1 answer
1.4k
1.4k views
here what to do first as FIZZA and IMRAN both are unbalanced than either to do RR rotation from FIZZA-IMRAN-NAVEEN or RL rotation from IMRAN-NAVEEN-LOVELY
0 0 votes
2 2 answers
729
729 views
2 2 votes
1 1 answer
716
716 views
Consider the problem of construction of a minimum cost binary search tree for a given set of ‘$n$’ identifiers with their respective probabilities. The time complexity of...
0 0 votes
0 0 answers
1.9k
1.9k views
Consider the following instance of OBST (Optimal Binary search Tree) problem.N = 4; <$a_1$, $a_2$, $a_3$, $a_4$ = <do, if, int, while>P(1...4) = <3,3,1,1>; Q(0...4) = <2,...
4 4 votes
1 1 answer
1.0k
1.0k views
Which of the following statements is/are TRUE?Suppose there are $n$ nodes are present in a binary search tree. The height of any binary search tree is $\theta (\log n)$$\...
1 1 vote
1 1 answer
1.4k
1.4k views
The postorder traversal of a binary search tree is $25, 33, 30, 35, 42, 48, 40, 60, 58, 50$. The inorder traversal of the same tree is $25, 30, 33, 35, 40, 42, 48, 50, 58...
4 4 votes
5 5 answers
9.3k
9.3k views
Let us there are n nodes which are labelled.Then the number of trees possible is given by the Catalan Number i.e $\binom{2n}{n} / (n+1)$Then the binary search trees possi...
0 0 votes
0 0 answers
1.1k
1.1k views
When searching for the key value 50 in a binary search tree, nodes containing the key values 10,15,20,30,60,80,89,90 are traversed, not necessarily in the given order. Ho...
0 0 votes
1 1 answer
668
668 views
Can binary serach tree have duplicate elements in the tree?