Question discussion

Keys 45, 25, 65, 15, 35, 55, 75, 30 are inserted in this order into an empty binary search tree. What is its preorder traversal?

909Medium DSSSB TGT Computer Science 0 replies 1 views
0

Keys 45, 25, 65, 15, 35, 55, 75, 30 are inserted in this order into an empty binary search tree. What is its preorder traversal?

  • A15 25 30 35 45 55 65 75
  • B15 30 35 25 55 75 65 45
  • C45 25 65 15 35 55 75 30
  • D45 25 15 35 30 65 55 75
Correct answer: D

Explanation

The root is 45; its left subtree has root 25 (children 15 and 35, with 30 under 35) and its right subtree has root 65 (children 55 and 75), so preorder is 45 25 15 35 30 65 55 75.

Discussion 0

Nobody has replied yet. Start the discussion!