Saved Bookmarks
| 1. |
Write a program to find the path from root to any given node in a binary search tree. |
|
Answer» Explanation: 1) If the two nodes are in DIFFERENT subtrees of root nodes. That is ONE in the left subtree and the OTHE in the right subtree. In this case it is clear that root NODE will lie in between the path from node1 and node2 2) If the nodes are in the same subtree. That is either in the left subtree or in the right subtree |
|