HeapSort implementation with relative test