this post was submitted on 04 Nov 2025
431 points (99.1% liked)

Programmer Humor

27193 readers
1023 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[โ€“] theunknownmuncher@lemmy.world 23 points 1 day ago* (last edited 1 day ago) (1 children)

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.

[โ€“] ulterno@programming.dev 0 points 5 hours ago

because it does not require comparing any of the elements of the collection

Well, if you are comparing x + a to y and x + b to y and then both to y', then y'' and so on, then are you really not comparing a to b?