This is a "How To" program explaining how to sort a list using a heapsort I recommend using Turbo Mode. Click on the green flag to see it in action Adjust the List Size variable if you want to try different sized lists A couple of reasons a heapsort may be more desirable than a quicksort are: A. Worst case complexity is only O(N log N) vs O(N^2) for quicksort B. Iterative version is straight forward (recursion in Scratch requires you to manage your own stack) It should be noted that a heapsort is not a stable sort. The other downside to implementing any algorithm in Scratch is that lists are 1-based and almost all examples are 0 based. Please let me know if you have questions or comments. Cheers, Joshua
Added 2013-08-17 See http://en.wikipedia.org/wiki/Heapsort