|
|
|
|
|
by robconery
2642 days ago
|
|
OP here. Big O is indeed "worst case scenario" always, the size of the data set doesn't matter. An O(n) operation doesn't care if the data is sorted - even if it's the first item as you suggest. When you discuss Big O it's always worst case. |
|
You're going to be limited to "quicksort is O(n^2)" and "hash table lookup is O(n)", both of which are quite misleading.
There are good reasons that we usually look at the worst case, but big-O does not fundamentally or necessarily mean that.