recategorized by
542 views
0 votes
0 votes

We create a binary search tree $\text{B}_{1}$ by inserting the numbers $1,2,3,4,5$ into an empty binary search tree. We create another binary search tree $\text{B}_{2}$ by inserting the numbers into an empty binary search tree in the reverse order. What is the difference between the right-most element of $\text{B}_{2}$ and the left-most element of $\text{B}_{2}$?

  1. $2$
  2. $3$
  3. $1$
  4. $4$
recategorized by

1 Answer

0 votes
0 votes

Rightmost Element of BST= Largest Number

Left most Element of BST= Smallest Number

Rightmost of BST(B1)=5 and Leftmost of BST(B2)=1

Difference=5-1

=4,So D is the correct answer.

Binary Search tree(B1) with 1,2,3,4,5             &                   Binary Search Tree(B2) with 5,4,3,2,1

1                                                                                                               5

   2                                                                                                        4

      3                                                                                                 3

          4                                                                                          2

              5                                                                                 1

Answer:

Related questions

0 votes
0 votes
1 answer
3
admin asked Jan 5, 2019
448 views
Consider the following array of elements$<70, 23, 60, 19, 13, 16, 1, 4, 8, 12, 7, 10, 85>$The minimum number of interchanges needed to convert into a max-heap is $4$$1$$3...