r/AskComputerScience • u/Leading-Fail-7263 • Apr 10 '26
What is average case complexity?
the average-case complexity of an algorithm is the amount of some computational resource (typically time) used by the algorithm, averaged over all possible inputs.
Aren't there infinite possible inputs? How does that make sense?
4
Upvotes
View all comments
Show parent comment
2
u/jeffbell Apr 10 '26
It’s interesting to compare quicksort and bubble sort.
They both have n-squared worst case behavior, however there are many common inputs to bubble sort that take n square time, but worst case input for quicksort is very rare.