Heap Sorting Challenge 5: The Infinite Loop of Despair

Can you sort 10,000 elements in a heap without losing your mind?

Warning: this challenge is not for the faint of heart. The algorithmic complexity will drive you to the brink of insanity.

Good luck, and may the odds be ever in your favor.