Answer it
Building and traversing a binary search tree
5 marksYou mark it yourself against the marking points
A climbing wall keeps members' ID numbers in a binary search tree. Smaller values go to the left of a node and larger values to the right. These IDs are inserted into an empty tree in this order:
41, 17, 63, 8, 29, 50, 72, 25
(a) State the parent node of 25 in the finished tree. [1]
(b) State the order in which the nodes are visited in an in-order traversal. [1]
(c) State the order in which the nodes are visited in a pre-order traversal. [1]
(d) State the order in which the nodes are visited in a post-order traversal. [1]
(e) Explain why an in-order traversal of any binary search tree gives the values in ascending order. [1]
[5]