write a rap song about the worst-case time complexity of the bubble sort algorithm in the style of biggie smalls

1 upvote

3 years and 10 months later

GPT-3.5

Yeah, what's up y'all, it's ya boy Biggie Smalls Coming at you with some real talk about bubble sort It's a popular algorithm, I ain't gonna lie But the worst-case time complexity, it'll make you wanna cry See, the worst-case time complexity of bubble sort Is O of n squared, that's the report That means if you've got a big list of items to sort It's gonna take a long time, no need to resort But why is that, you might ask Well, let me break it down real quick, no need to mask The bubble sort algorithm, it works like this It compares each item to its neighbor, and swaps 'em if there's a miss So if the list is already in order, it's easy peasy But if it's all jumbled up, it gets real sleazy It's gotta make all those comparisons, one by one Until everything is in its place, and the sorting is done And that's why the worst-case time complexity is so bad It's gonna take a long time, and it'll make you mad But don't worry, there's other algorithms out there Quicksort, heapsort, they'll get the job done without a care So that's it y'all, Biggie Smalls signing off Remember, when it comes to sorting, bubble sort is wack, yo. Peace out.

GPT-6 Astra

“Quadratic Pressure”

[Verse 1]
Uh—array rolled up with the numbers all reversed,
Biggest in the front, had the smallest looking cursed.
Two neighbors face off, check who belongs where,
Left too heavy? Swap ’em—slide ’em one chair.

Big dog bubbles to the end of the line,
But the rest still crooked, so we run it one more time.
First pass, n minus one comparisons to do,
Next pass, n minus two—still a long way through.

I told the little loop, “You got expensive taste,”
All that back-and-forth, all that time you waste.
One sorted spot per pass, watch the boundary shrink,
But the bill keeps climbing quicker than you think.

[Hook]
n squared, baby—that’s the worst-case grind,
Double up the input, ’bout four times the time.
Neighbors keep trading till the order looks fine,
Bubble got a rhythm, but it takes its sweet time.

[Verse 2]
Count the checks clean, let the arithmetic speak:
One through n minus one—that’s the total we seek.
n times n minus one, then divide it by two,
That’s a quadratic tab coming straight back to you.

Reverse-sorted lineup? Every pair’s out of place,
Gotta swap each inversion in this neighbor-only race.
Same triangular count for the swaps on that ride,
No shortcut when the small ones need to reach the other side.

Drop the lower-order term, let the constants disappear,
Theta of n squared—make the tight bound clear.
Big-O’s n squared too, but Theta tells it tight:
Worst-case growth locked down from the left to the right.

[Bridge]
Got a flag for “no swaps”? That can end a sorted run,
Best case linear—one pass and you’re done.
But reversed? That flag ain’t saving your night,
Still quadratic work getting everything right.

[Hook]
n squared, baby—that’s the worst-case grind,
Double up the input, ’bout four times the time.
Constant extra space, but the clock won’t recline—
Bubble got a rhythm, but it takes its sweet time.

322 words

What changed

The real gap is in the rapping, not the facts. Both land on n squared, but GPT-3.5 mostly announces it (“Is O of n squared, that’s the report”) and pads its rhymes with filler like “no need to resort” and “no need to mask.” Its line that a sorted list is “easy peasy” quietly assumes an early-exit check it never mentions. Astra turns the derivation into verses: “n minus one comparisons,” then “n times n minus one, then divide it by two,” plus the swap-flag bridge that explains why the best case is linear but the reversed case isn’t. “Double up the input, ‘bout four times the time” is a sharp way to make quadratic growth stick.

Neither really sounds like Biggie. GPT-3.5 just says it is him and signs off with “bubble sort is wack, yo,” which has a goofy charm. Astra has better flow and swagger (“You got expensive taste”), but beyond an opening “Uh,” it could be anyone’s.

From December 2022 to March 2023, visitors to LearnGPT, the earlier version of Emergent Mind, shared ChatGPT conversations they found useful or funny. On October 19, 2026, each prompt went to GPT-6 Astra exactly as it was shared: one message, no system prompt, default reasoning effort. Claude Opus 5.5 wrote the analysis under each pair after reading both answers. Original answers appear as the people who shared them pasted them. A few examples are left out because they depended on missing context or weren't appropriate to republish.

More from Emergent Mind Labs