Alex Nadalin
May 14 · 1 min read

The big O notation (generally) takes into account the best, worst and average case scenario.

That is exactly because cases like these need to be put into context. For example, you cannot say that searching in a hashtable takes O(1) because that’s simply not true for all implementation, but you should say that the best case scenario is O(1) and worst case scenario is O(n).

Check the table in the Wikipedia article, it actually reports the average and worst-case scenario:


    Alex Nadalin

    Written by

    CTO at @NamshiDotCom, I like distributed systems, Golang, NodeJS, scalability, software design and µseconds. Writing :wq