ISRO Computer Science (CSE) 2023 - Question 26

All ISRO Computer Science (CSE) papers | ISRO Computer Science (CSE) 2023

Topic: Data Structures

What is the Inorder predecessor of 15 in the Binary Search Tree shown below
(Tree contains root 15, left child 6, right child 18. 6 has left child 3, right child 7. 18 has left child 17, right child 20. 3 has left child 2, right child 4. 7 has right child 13. 13 has left child 9)

  • A. 18
  • B. 7
  • C. 9
  • D. 13

Answer: D. 13

Explanation: The inorder predecessor of a node in a BST is the maximum value in its left subtree. The left child of 15 is 6. Following the rightmost path in the left subtree: 6 -> 7 -> 13. Node 13 has no right child, making it the maximum value in 15's left subtree. Thus, 13 is the inorder predecessor.

| | All questions of ISRO Computer Science (CSE) 2023