this post was submitted on 01 Sep 2026
92 points (100.0% liked)
Programmer Humor
33288 readers
1018 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
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
- If the mod doesn't find it funny, you're banned. Ha-ha!... For real: do not use the community for "statements". There are other places for such content. Keep it chill and funny.
founded 3 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Indeed it is, Matt mentions in the video that it was originally conceived as a counterexample for students first learning about sorting algorithms, and I think in that instance it makes sense to take bubble sort and try to mangle it so the students have at least some frame of reference while debugging it. It just so happens that the mangling produced a different, weird but still valid kind of bubble sort, which I find charming.
It really does look more broken the more I look. I began to think that it would sort odd and even lists in opposite orders, since half the time it's comparing pairs the opposite way around.
not sure why you see different behaviour based on parity, but it does sort in descending order. that is why the inequality operator in
if A[i] < A[j] then swapis reversed.