The collective wisdom of the Scratch community concerning how to sort things. Any things.
A note to software writers: the majority of code posted sorts simple arrays.. Turns out in practise what is frequently needed is to sort records where there is a key and associated data along with that key. Yes, it's the same algorithm, but whereever the code swaps sortkeys, it has to also swap data records as well. If the data records are large, this is a big overhead so the usual solution is to only swap pointers to the data records rather than the records themselves. In scratch this would probably entail swapping indices rather than actual pointers.