Additional Exercises with Solutions
In this appendix we give additional exercise with their solutions.
D.1 Additional Exercises
D.1.1 Chapter 4: Loop Design Issues
- Arrange the following functions of n in their correct order, using the idea of Order notation, giving the reasons:
- Derive the asymptotic time complexity of the following algorithm:
Algorithm D.1 | print_n()
if n is non-zero then
print the value (n/10) using print _n;
print the digit (n mod 10);
- Here is a list of functions of one variable n:
n5/100, 5, (log 2 n)2, n2/(1 + n), 22 log2n, n2 log 2 n, n2 + 27n, 2n
Place them in a ...