Implemented heapsort
Re-factored the code to not use the index mapping from one-based to zero-based