2.17

From The Algorithm Design Manual Solution Wiki
Jump to navigation Jump to search

1. Pick c = 3/2. For [math]n>1[/math] [math]\displaystyle\frac{f(n)}{g(n)}=\frac{n^{2}+n+1}{2n^{3}}=\frac1{2n}+\frac1{2n^{2}}+\frac1{2n^{3}}\lt\frac12+\frac12+\frac12=\tfrac32[/math], so [math]f(n)\le\frac32\,g(n)[/math].

2. Pick c = 2. For [math]n>1[/math] [math]\displaystyle\frac{f(n)}{g(n)}=\frac{n\sqrt n+n^{2}}{n^{2}}=\frac1{\sqrt n}+1\le2[/math], hence [math]f(n)\le2\,g(n)[/math].

3. Pick c = 2. For [math]n>1[/math] [math]\displaystyle\frac{f(n)}{g(n)}=\frac{n^{2}-n+1}{n^{2}/2}=2-\frac{2}{n}+\frac{2}{n^{2}}\le2[/math], therefore [math]f(n)\le2\,g(n)[/math].


Back to Chapter 2