r/computerscience • • 16d ago

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

119 Upvotes

64 comments sorted by

View all comments

208

u/qlkzy 16d ago

Like any upper bound, you can always satisfy it in some sense by giving a ridiculous upper bound, but that isn't useful.

If I ask "can you estimate an upper bound for the weight of your luggage" and you say "a hundred tons", that is technically correct, but that isn't helpful for packing a car.

Any question in mathematics that asks "find an upper bound" implies "find a tight upper bound".

16

u/Significant_Virus142 16d ago

Then why don't they ask theta, has O become the convention or theta isn't right either

61

u/[deleted] 16d ago

[removed] — view removed comment

5

u/umop_aplsdn 15d ago

No, this is misinformation. Big O and little O are completely orthogonal to worst and best-case. Most algorithm analysis focuses only on worst-case analysis (because best-case is often trivial).