Given are five algorithms for the same (unknown) problem that get an array of size $n$ as the input.
The number of operations of the algorithms in dependence of $n$ are $log_2n$, $n$, $n \log_2 n$, $n^2$ and $2^n$,
respectively. Give their running times using an adequate time unit (e.g. nanoseconds,..., years) in
each case for different values of $n$. You can round the time values to integers and ignore running times
above 10 years.
(a) (1 point) Suppose your computer can do 10 operations per second.
n=10
n=20
n=21
n=1000
n=1000 000
n=1000 000 000
$log_2 n$
$n$
$n \log_2 n$
$n^2$
$2^n$
Solution:
$log_2 n$
$n$
$n \log_2 n$
$n^2$
$2^n$
n=10
300ms
1s
3s
10s
2min
n=20
400ms
2s
9s
40s
1d
n=21
400ms
2s
9s
44s
2d
n=1000
1s
2min
17min
1d
> 3. $10^{292}$y
n=1000 000
2s
1d
23d
3k y
n=1000 000 000
3s
3y
95y
3000 mio y
(b) (1 point) Suppose your computer can do 1000 000 operations per second.