Recent questions tagged binary-search-tree

39 39 votes
4 answers 4 answers
19.2k
19.2k views
How many distinct BSTs can be constructed with $3$ distinct keys?$4$$5$$6$$9$
46 46 votes
3 answers 3 answers
11.1k
11.1k views
A Binary Search Tree (BST) stores values in the range $37$ to $573$. Consider the following sequence of keys.$81, 537, 102, 439, 285, 376, 305$$52, 97, 121, 195, 242, 381...
78 78 votes
4 answers 4 answers
24.2k
24.2k views
A Binary Search Tree (BST) stores values in the range $37$ to $573$. Consider the following sequence of keys.$81, 537, 102, 439, 285, 376, 305$$52, 97, 121, 195, 242, 381...
45 45 votes
4 answers 4 answers
19.7k
19.7k views
Which of the following is TRUE?The cost of searching an AVL tree is $\Theta (\log n)$ but that of a binary search tree is $O(n)$The cost of searching an AVL tree is $\The...
72 72 votes
10 answers 10 answers
32.8k
32.8k views
A binary search tree is used to locate the number $43$. Which of the following probe sequences are possible and which are not? Explain.$\begin{array}{llllll} \text{(a)} ...
36 36 votes
6 answers 6 answers
37.0k
37.0k views
A binary search tree is generated by inserting in order the following integers:$$50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24$$The number of nodes in the left subtree and ...
71 71 votes
7 answers 7 answers
47.5k
47.5k views
A binary search tree contains the value $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 sequences is a...
191 191 votes
11 answers 11 answers
52.0k
52.0k views
Suppose we have a balanced binary search tree $T$ holding $n$ numbers. We are given two numbers $L$ and $H$ and wish to sum up all the numbers in $T$ that lie between $L$...
41 41 votes
4 answers 4 answers
17.6k
17.6k views
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 sam...
65 65 votes
6 answers 6 answers
21.4k
21.4k views
Which one of the following is the tightest upper bound that represents the time complexity of inserting an object into a binary search tree of $n$ nodes?$O(1)$$O(\log n)$...
49 49 votes
6 answers 6 answers
39.7k
39.7k views
How many distinct binary search trees can be created out of $4$ distinct keys?$5$$14$$24$$42$
36 36 votes
5 answers 5 answers
16.3k
16.3k views
Postorder traversal of a given binary search tree, $T$ produces the following sequence of keys$10, 9, 23, 22, 27, 25, 15, 50, 95, 60, 40, 29$Which one of the following se...
64 64 votes
7 answers 7 answers
58.2k
58.2k views
What is the maximum height of any AVL-tree with $7$ nodes? Assume that the height of a tree with a single node is $0$.$2$$3$$4$$5$
159 159 votes
15 answers 15 answers
59.8k
59.8k views
A program takes as input a balanced binary search tree with $n$ leaf nodes and computes the value of a function $g(x)$ for each node $x$. If the cost of computing $g(x)$ ...
39 39 votes
6 answers 6 answers
29.7k
29.7k views
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 (the heigh...
94 94 votes
4 answers 4 answers
31.5k
31.5k views
A data structure is required for storing a set of integers such that each of the following operations can be done in $O(\log n)$ time, where $n$ is the number of elements...
33 33 votes
3 answers 3 answers
29.5k
29.5k views
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 o...
125 125 votes
9 answers 9 answers
42.5k
42.5k views
Let $T(n)$ be the number of different binary search trees on $n$ distinct elements.Then $T(n) = \sum_{k=1}^{n} T(k-1)T(x)$, where $x$ is $n-k+1$$n-k$$n-k-1$$n-k-2$
43 43 votes
3 answers 3 answers
12.7k
12.7k views
Insert the following keys one by one into a binary search tree in the order specified.$$15, 32, 20, 9, 3, 25, 12, 1$$Show the final binary search tree after the insertion...
193 193 votes
7 answers 7 answers
61.3k
61.3k 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...
71 71 votes
5 answers 5 answers
24.2k
24.2k views
The worst case running time to search for an element in a balanced binary search tree with $n2^{n}$ elements is$\Theta(n\log n)$$\Theta(n2^n)$$\Theta(n)$$\Theta(\log n)$