CS2
Week 5: Algorithm analysis, searching, sorting
9
Program analysis
nAnother reason why programmers like big O is that it can often be concluded from the control structures in a program
nE.g. , no loops or recursion – O(1)
nA single counting loop or recursion that simplifies by a fixed amount – linear n
nA double nested FOR loop – ?
nRecursion that divides by a fixed constant - ?