1762599776563.webp
SN1

1762599776563.webp

  • Media owner SN1
  • Ngày thêm
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)
Chưa có bình luận nào.

Thông tin

Category
CSD201
Thêm bởi
SN1
Ngày thêm
Lượt xem
123
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom