View worked solution
Answer: 4:4
To find the number of edges in the path from the node containing to the root node, we construct the Binary Search Tree (BST) by inserting the elements one by one in the given order: .
Step-by-Step Insertion:
- Insert : Root of the tree.
10 - Insert : Since , insert as the left child of .
10 / -4 - Insert : Since , insert as the right child of .
10 / \ -4 15 - Insert : , insert as the right child of .
10 / \ -4 15 \ 30 - Insert : , insert as the left child of .
10 / \ -4 15 \ 30 / 20 - Insert : , insert as the right child of .
10 / \ -4 15 \ \ 5 30 / 20 - Insert : , insert as the right child of .
10 / \ -4 15 \ \ 5 30 / \ 20 60 - Insert : , insert as the left child of .
10 / \ -4 15 \ \ 5 30 / \ 20 60 / 19
Path from to the Root ():
The path from node to the root node is:
The number of edges in this path is the number of transitions between nodes, which is:
Free practice · Your answers on this page are not saved.
