When you calculate the Big-O for a function you always want to think of very,very large numbers. That helps you determine the performance of your function when the sample size goes to infinity (in other words, when it grows very very large).
Usually, after you compute the Big-O you will also want to look for the n0
number. You can think of this n0
number as the tipping point. The performance of the function with any number larger than n0
will be equal to Big-O. For smaller numbers, the performance will be dictated by the constants, or other factors in the function. That is why the Big-O alone is not sufficient when assessing the performance of a function (although it's the first thing you should determine). After you determine the Big-O, you should benchmark or time your function and determine the n0
tipping point and determine what sample sizes, or number of items, will your function process the majority of the time.
Sometime you will write functions that will work on relatively small sets of numbers (say 10s or 100s) and some times your functions will be expected to process items on the order of millions or billions.