r/computerscience • • Sep 17 '26

Help Why use Big O notation?

If someone asks for big O time complexity of an algorithm but expects only the minimum of the possible big Os then is that even Big O notation anymore? cuz if the big o time complexity of an o(n) algorithm is asked then according to the condition of big O notation O(n square) would also be a valid answer

117 Upvotes

64 comments sorted by

View all comments

Show parent comment

4

u/CattleHot9774 Sep 17 '26

in this case it'd be correct to say the best case runtime is theta(1) and worst case theta(n), right?

2

u/not-just-yeti Sep 17 '26

Yes! And the big-Theta (rather than big-Oh) is communicating that each of these is a tight bound.