Added a more effective version of heap sort implementation (by modifying the way the heap is built).