Find the big-O running time of the following program:
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Big-O notation represents the asymptotic relation between input size and amount of calculations (running time).
In this particular program, there is no input involved. The amount of calculations, and the running time, is constant as input size changes. No matter what that constant is, asymptotically, it increases in the same way as any other constant (in fact it doesn't increase at all), and so the correct answer is,
O ( 1 )