Exercise I
- Use Big-Oh notation to describe the asymptotic running time of a program given its precise running time as a function of input size.
Assume that each of the expressions below gives the processing time spent by an algorithm for solving a problem of size . Specify the asymptotic running time in Big-Oh notation.
Exercise
Solution
The dominant term is , so the runtime is .
Exercise
Solution
Let's simplify the expression; this requires a certain level of mathematical literacy. Most of what is done below are based on the laws of logarithms.
The dominant term is , so the runtime is .
Note, is and is larger than for all .
You might be wondering how I know which term has the highest order (fastest rate of growth). This, again, requires a certain level of mathematical literacy. However, a dozen functions show up in most practical cases, and we will survey them in a later lesson.