retagged by
498 views
1 1 vote

Consider a Binary Search Tree (BST) in which all keys are distinct. For a node $v_i$, let $\text{succ}(v_i)$ denote its in-order successor. If $v_i$ has no in-order successor, then $\text{succ}(v_i) = \text{NULL}$.

Define a set $K$ as follows:

For every leaf node $v_i$ such that $\text{succ}(v_i) \ne \text{NULL}$, choose a key $k_i$ satisfying
\[
\text{val}(v_i) < k_i < \text{val}(\text{succ}(v_i))
\]
and include $k_i$ in $K$. $($Assume such a key can be chosen whenever $\text{succ}(v_i) \ne \text{NULL})$.

Now, insert all keys of $K$ into the given BST (in any order), maintaining the BST property.

Which of the following statements is/are necessarily true?

  1. $K$ contains no duplicate keys.
     
  2. After inserting all keys from $K$, the height of the BST increases by at most $1$.
     
  3. After inserting all keys from $K$, the number of nodes in the BST becomes exactly double.
     
  4. The set $K$ is non-empty (contains at least one key).

Please log in or register to answer this question.

Answer:
Position:
Show:

Related questions

1 1 vote
1 1 answer
446
446 views
GO Classes asked Feb 10
446 views
Stack $\mathrm{S}$ and Queue $\mathrm{Q}$, both are initially empty. Each has sufficient capacity to handle all elements.Elements are inserted only in the order: $1,2,3,4...
2 2 votes
0 0 answers
479
479 views
1 1 vote
1 1 answer
486
486 views
GO Classes asked Feb 10
486 views
Using Hashing, with chaining (when collision occur). After inserting the following numbers what is the length of longest chain is?$$28,19,10,12,5,15,33,26,17$$Hash functi...
1 1 vote
1 1 answer
452
452 views
GO Classes asked Feb 10
452 views
$\text{Match the following :}$\[\begin{array}{lcl}\text{List I} & &\text{List II} \\A.\text{Inorder} & &P.\ \text{Left subtree, Root, Right subtree} \\B.\text{Preorder} &...