152k views
1 vote
Electronically, or on paper draw a Binary Search Tree using the values below. Note: Insert each value into the tree in order from left to right following the procedure discussed in class.

25, 14, 7, 32, 27, 2, 29,9,35
On a separate electronic page or sheet of paper:
1. List the values using in order traversal
2. List the values using pre-order traversal
3. List the values using post-order traversal

1 Answer

6 votes

Answer:

A.) in order traversal - 9 32 35 14 27 25 2 7 29

B.) pre-order traversal - 25 14 32 9 35 27 7 2 29

C.) post-order traversal - 9 35 32 27 14 2 29 25

Step-by-step explanation:

Given - 25, 14, 7, 32, 27, 2, 29,9,35

To find - On a separate electronic page or sheet of paper:

1. List the values using in order traversal

2. List the values using pre-order traversal

3. List the values using post-order traversal

Proof -

Given values are -

25, 14, 7, 32, 27, 2, 29,9,35

1.)

In order is -

9 32 35 14 27 25 2 7 29

2.)

Pre-order is - (Root left right)

List nodes of first time visit

25 14 32 9 35 27 7 2 29

3.)

Post-order is - (Left Right Root)

List nodes of third time visit

9 35 32 27 14 2 29 25

Electronically, or on paper draw a Binary Search Tree using the values below. Note-example-1
User Maechler
by
5.9k points