Consider the following Binary Search Tree (BST). Which node contains the…

2014

Consider the following Binary Search Tree (BST). Which node contains the fourth smallest element in T?

Binary search tree T

Answer: C. WCorrect answer: W In a BST, inorder traversal visits nodes in ascending order. So the fourth smallest node is the fourth node in the inorder sequence. Inorder…

  1. A.

    Q

  2. B.

    V

  3. C.

    W

  4. D.

    X

Attempted by 622 students.

Show answer & explanation

Correct answer: C

Correct answer: W

In a BST, inorder traversal visits nodes in ascending order. So the fourth smallest node is the fourth node in the inorder sequence.

Inorder sequence: U, Q, X, W, P, V, Z, Y

Counting from the start: U is 1st, Q is 2nd, X is 3rd, and W is 4th.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…