Understanding Time Bounds
In general, we can think of a program as being composed of several steps. Each step involves
the execution of one or more primitive operations in the programming language (e.g. adding two
numbers, storing an integer in an array, creating an object). The number of steps performed by
a program depends on the size of the input to that program, so a function is used to characterise
that number of steps.
In the table below, g(n) represents the number of steps used by a program whose input is of size
n, and N represents an actual input size. Suppose that each Python primitive operation takes 1
microsecond (10$^{-6}$ seconds). On the Hacker Rank platform, a Python program is given 10 seconds
to complete running on each test case, otherwise it is terminated, and the submission is deemed to
have failed on the given test case. (A little clock symbol is shown beside the test case).
For each pair (N, g(n)), determine the maximum (whole) number of primitive operations that could
be performed on average per step by the program without exceeding the time limit on HackerRank.
The row for g(n) = n has been filled in as an example.
g(n)
N (max value of n)
10$^3$ 10$^5$ 10$^7$ 10$^9$
$\lg n$
$n$
$n \lg n$
$n^2$
$2^n$
10$^4$ 100 1 0