in DS retagged by
404 views
6 votes
6 votes

Suppose we constructed the binary search tree shown by starting with an empty tree and inserting one element at a time from an input sequence, without any rotations or other manipulations. Which of the following assertions about the order of elements in the input sequence can NOT  be true?

  1. $8$ came after $3$ and $19$ came after $29.$
  2. $7$ came before $8$ and $23$ came after $37.$
  3. $1$ came after $12$ and $29$ came before $42.$
  4. $3$ came before $14$ and $16$ came before $28.$
in DS retagged by
404 views

1 comment

$ \large{\colorbox{yellow}{Detailed video solution of this question with direct time stamp}}$

All India Mock Test 4 - Solutions Part 1

0
0

1 Answer

6 votes
6 votes
$28$ is an ancestor of $16,$ so $16$ must have come after $28.$ In the tree, only ancestor-descendant relationships matter in determining the order in which elements arrive. An ancestor must always come before any of its descendants. Incomparable elements could come in any order.
edited by

1 comment

I solved it by brute force.. and i don’t know this optimized technique..
again learned some optimized techniques to solve the question..
thanks a lot go classes..
1
1
Answer:

Related questions