A-level Computing/AQA/Problem Solving, Programming, Operating Systems, Databases and Networking/Problem Solving/BigO notation

Timing
You can work out the time that an algorithm takes to run by timing it:

However, this isn't always suitable. What happens if you run some code on a 33 MHz processor, and some code on a 3.4 GHz processor. Timing a function tells you a lot about the speed of a computer and very little about the speed of an algorithm.

Refining algorithms
optimised version