recategorized by
1,421 views
0 votes
0 votes
Identify the correct sequence for searching 105 in a binary search tree?

a. 500,250,190,220,150,120,105
b. 80,800,500,90,270,280,105
c. 20,30,80,200,90,120,105
d. 30,50,80,200,90,120,105

Plz help me.
recategorized by

1 Answer

Best answer
2 votes
2 votes

Searching in a BST always starts at the root. We compare a data stored at the root with the key we are searching for. If the node

does not contain the key we proceed either to the left or right child depending upon the comparison. If the result of the comparison is

negative we go to the left child, otherwise - to the right child. 

You need to check the following conditions:

(i) The left sub-tree of a node contains only nodes with keys less than the node's key.

(ii) The right sub-tree of a node contains only nodes with keys greater than the node's key.

Options  C and D are correct sequences for 150.

edited by

Related questions

0 votes
0 votes
1 answer
2
aditi19 asked Oct 1, 2018
620 views
what are the applications of optimal binary search tree?
1 votes
1 votes
0 answers
3
Anjan asked Jan 9, 2018
335 views
Find number of BST's possible with 6 nodes numbered 1,2,3,4,5 and 6 having 6 as root and height of 4 ?please explain in detail ...
3 votes
3 votes
2 answers
4
VS asked Jan 3, 2018
835 views
Consider a Binary Search Tree is created using element 1 to n in following order: 3, 2, 1, 6, 5, 4, 9, 8, 7, 12, 11, 10, ....., n – 3, n – 4, n �...