Question 1: (3 marks)
Write a program to build a BST (Binary Search Tree) by inserting N (1 ≤ N ≤ 100) integer values into
the BST one by one. Note that the nodes have no duplicate values.
Your task is reverse traversing of the BST which node's value must be greater than or equal to V.
Here are 3 steps of reverse traversing algorithm:
For example,
Step 1: Right-child traversing
Step 2: Process current node
Step 3: Left-child traversing
Create a BST tree by inserting into the tree N integer values as follows: 7, 9, 4, 1, 12, 6, 10.
The value of V is 7.
2 of 3
Paper No: 1
The reverse traversing of the BST tree which node's value are greater than or equal to 7 is: 12, 10,
9, 7.
6
10
Figure 1. The BST that created by inserting 7, 9, 4, 1, 12, 6, 10 one by one
(12)