this post was submitted on 08 Apr 2025
735 points (98.4% liked)

Programmer Humor

22403 readers
3407 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
[–] magic_lobster_party@fedia.io 7 points 6 days ago (1 children)

Maybe.

When using a random pivot, the worst case becomes exponentially more unlikely the larger the n. The O notation only cares about the complexity when n approaches infinity. So when n approaches infinity, the likelihood of O(n^2) performance approaches 0 (and the likelihood of O(n log n) approaches 1).

I think it’s fine to call it O(n log n).

[–] MBM 4 points 6 days ago

That's when you add a w.h.p. (with high probability)