Binary Search trees, Tree traversals, Heap Building
help me learn.
part a. 2p
Pick 15 random values from 20 to 90, they should not be in increasing or decreasing order.
You can use an online service such as
where the parameter would be: 15 instead of the value 100 (to generate 15 integers), 20 instead of the value 1 (the value between) and 90 instead of value 100 (the maxvalue) and format in 1 columns.
With these 15 values that should be unique for each student build the binary search tree that results of adding the values to that BST in the order chosen.
Your submission for part a of the assignment should be the sequence of the 15 values and the Binary Search Tree drawn (either by hand and the picture of the tree or drawn in the computer)
part b. 2p
Show the tree traversals for the Binary Search Tree that you built at part a:
give the preorder traversal
give the inorder traversal
give the postorder traversal
give the level order traversal
You submission for part b should be 4 sequences of the 15 values in the correct order corresponding with the 4 tree traversals (corresponding to the BST drawn at part a)
part c. 3p
Consider the 15 values from part a in an array and show the array how it changes for heapification
give each step of the heapification by giving the array side-by-side with the actual heap drawn (see an example in the ppt for week 11 at slide 13 and 14 about adding an entry to the heap)
another example is at slide 25 of the same Week 11 PPT.
The submission for part c should be also hand-written array/heap or computer generated pictures integrated into a PDF/word file.