Question 44Asked in UGC NET Computer Science, June 2016 (Paper II & III, Selected Questions)

Suppose that we have numbers between 1 and 1,000 in a binary search tree and want to search for the number 364. Which of the following sequences could not…

Suppose that we have numbers between 1 and 1,000 in a binary search tree and want to search for the number 364. Which of the following sequences could not be the sequence of nodes examined?
  1. A925, 221, 912, 245, 899, 259, 363, 364
  2. B3, 400, 388, 220, 267, 383, 382, 279, 364
  3. C926, 203, 912, 241, 913, 246, 364
  4. D3, 253, 402, 399, 331, 345, 398, 364
Show answerHide answer

Correct answer: (C) 926, 203, 912, 241, 913, 246, 364

Explanation

In sequence (c), after visiting 912 (912 > 364) the search moves to the left subtree of 912, so every later node must be less than 912. 913 cannot appear after 912. So, the answer is (c).

From UGC NET Computer Science PYQ, June 2016 (Paper II & III, Selected Questions)

This is question 44 of UGC NET Computer Science PYQ, June 2016 (Paper II & III, Selected Questions). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.