For a Binary Search Tree containing distinct keys, which traversal can be used to obtain the keys in sorted descending order?

Options

  • A. Inorder traversal
  • B. Reverse inorder traversal
  • C. Preorder traversal
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. Reverse inorder traversal

Detailed Explanation

For a BST, normal inorder traversal is Left → Root → Right and produces ascending order. To obtain the keys in descending order, use reverse inorder traversal: Right → Root → Left. This works because all values in the right subtree are greater than the current node, while values in the left subtree are smaller. Reverse inorder is therefore a useful BST technique for descending sorted output.