Heap Sort
•	See the board for demonstration
•	Given an array, draw the corresponding tree
•	Use reheap algorithm to turn the tree into a heap
•	Reheap algorithm
•	Assume left and right subtrees are heaps
•	Compare the root with roots of left and right subtrees
•	Larger one moves into the root
•	If the item that was moved was from left or right subtree, that subtree may not be a heap anymore
•	apply reheap to that subtree
•	Heapify
•	Start from the middle of the tree first subtree with children
•	and reheap that keep on going until we come to the first element
•	Actul sort
•	Swap the item in root with the last element in the array
•	Now last item is the largest one, exactly where we wanted it.
•	We ignore the last item, our tree shrinks in size by one
•	Apply the reheap algorithm
•	Keep on repreating until our tree is of the size 1
•	Reheap takes no more than log n, i.e. O(log n)
•	Heapify calls reheap n/2*O(log n) = O(n log n)
•	Actual sorting
•	reheap is called n - 1 times, O(n) times
•	O(n)*O(log n) = O(n log n)
•	Total = O(n log n) + O(n log n) = O(n log n)
http://www.toolsofcomputing.com/heap_sort.htm