Professional Documents
Culture Documents
Assignment 2
Assignment 2
Assignment 2
216088403
ITEC 2620
Prof. Xin Tan
BST
BST maximum
Array a = [1,2,3,4,5,6]
Step 2 - Add 1
Step 3 - Add 2
Step 4 - Add 3
Step 5 - Add 4
Step 6 - Add 5
Step 7 - Add 6
BST minimum
Array a = [0,1,2,3,4,5,6]
Procedure to follow : -
Now find the mid of the array and that will be the root.
Input :
Step 1 : remove root node 3 and that will make node 4 as root node as it is smallest in the right
hand tree
Step 2 : remove root node 4
Empty
Heaps
Building heap using BuildMaxHeap(A)
[73,6,57,88,60,42,83,72,48,85]
Remove 6 and the tree will be empty and heap sort done.