The program goes through the collection of numbers and prints each one after a delay of milliseconds equal to that number: “Print the number 20 after a 20 millisecond delay. Print the number 5 after a 5 millisecond delay. Print the number 100 after a 100 millisecond delay… etc…” effectively sorting the collection because the numbers will be printed in order from smallest to largest.
This is a clever (but impractical) way to sort a collection, because it does not require comparing any of the elements of the collection.
The program goes through the collection of numbers and prints each one after a delay of milliseconds equal to that number: “Print the number 20 after a 20 millisecond delay. Print the number 5 after a 5 millisecond delay. Print the number 100 after a 100 millisecond delay… etc…” effectively sorting the collection because the numbers will be printed in order from smallest to largest.
This is a clever (but impractical) way to sort a collection, because it does not require comparing any of the elements of the collection.