BST Traversal
Draw the Binary Search Tree (BST) we would get if we were to insert the letters C O M P U T E R S in the
order listed (i.e., C is the first letter added to the tree).
Given that BST, what would be the order of the nodes visited in:
1. A pre-order traversal
2. A post-order traversal
3. An in-order traversal
2 Try again
Repeat Question 1, but with the letters S R E T U P M O C
3 And the other way
Draw a binary tree1
that would produce the following results:
What to hand in
You must submit a file called ex3.txt with the answers to questions 1 and 2 in the following format:
1.1 C,O,M,P,U,T,E,R,S
1.2 S,R,E,T,U,P,M,O,C
1.3 H,I,A,N,N,A,A,N,D,B,R,I,A,N
2.1 A,B,C,D,E,F,G
2.2 T,H,E,S,E,A,R,E,N,O,T,T,H,E,C,O,R,R,E,C,T,A,N,S,W,E,R,S
2.3 H,E,L,L,O,W,O,R,L,D
That is, questions 1.1 - 2.3 each on their own line, starting with the question number and ending with the
traversal number. One space between the question number and the traversal, no other spaces.
You do not need to submit a solution for question 3 (though you should try it).
Get Free Quote!
315 Experts Online