22.5k views
0 votes
Which one of the following inputs cannot create this binary search tree?

a. 53, 20, 60, 99, 18, 39, 29, 32
b. 53, 20, 60, 99, 18, 39, 32, 29
c. 53, 60, 20, 99, 18, 39, 32, 29
d. 53, 20, 60, 99, 39, 18, 32, 29

1 Answer

5 votes

Final answer:

Option B: 53, 20, 60, 99, 18, 39, 32, 29 cannot create this binary search tree.

Step-by-step explanation:

The binary search tree is a data structure in computer science used for efficient searching and sorting. In a binary search tree, each node has a key value and two child nodes. The left child node contains values less than the key, and the right child node contains values greater than the key.

Looking at the options given, we can see that option B: 53, 20, 60, 99, 18, 39, 32, 29 cannot create this binary search tree. This is because the values 32 and 29 are out of order. In a binary search tree, the left child node should always contain values less than the key, so 29 should be the left child of 32 rather than the other way around.

To create a binary search tree, the values must be inserted in the correct order to maintain the binary search tree property.

User Saqib Razzaq
by
9.2k points