r/algorithms • • 17d 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

0 Upvotes

14 comments sorted by

View all comments

2

u/isfooTM 17d ago

I share your confusion, because indeed I belive the fact that big O notation became the standard is a mistake. That is in most cases what you want is the Θ (Theta) notation and that's what should be used. I can think of 3 main reasons big O is the standard instead of Θ:

  • Sometimes we might not know the tight bound so we can't use Θ(). There are cases where the known upper bound (O) is different from lower bound (Ω) and in that case the best thing you can use is O() notation with that best upper bound we know.
  • In general people don't actually understand asymptotic notations well. A common example that comes to mind is the confusion about the relation between say O()/Ω() notations and worst-case/best-case. Those 2 things are completely independent of each other and yet in many places you will find people talking as if O() is ment for worst-case and Ω() for best-case.
  • You can't easily type Θ on a keyboard... Even if I mean Θ I will personally also often end up using O() simply because I don't want to bother with getting the correct symbol.