Homework Assignment 7 (Big O, Induction, Recursion)

Total Page:16

File Type:pdf, Size:1020Kb

Homework Assignment 7 (Big O, Induction, Recursion)

Homework Assignment 7 (Big O, induction, recursion) Reading Assignment: Rosen, Section 1.8, Section 3.3

Definitions: Big-O: f(x) is O(g(x)) if there is a constant c and a value k so that, for all xk, f(x)  c g(x). Big-: f(x) is  (g(x)) if there is a constant c and a value k so that, for all xk, f(x) c g(x). (Read this Big-Omega) Big-: f(x) is  (g(x)) if BOTH: f is O(g) AND g is O(f). (Read this Big-Theta)

I. Determine whether the following functions are in O(x):

a. f(x)=10 b. f(x)=3x+7 c. f (x)  x 2  x 1 d. f(x) = 5log (x) e. f(x)=|x| f. f(x) = x/2

II. For each of the above functions, determine if f(x) is (x) and whether it is (x).

III. Determine whether the following functions are in O(x2):

a. f(x)=17x+11 b. f(x) = x2+1000 c. f(x) = x log x d. f(x) = x4/2 e. f(x) = 2x f. f (x)  x x (floor of x times ceiling of x)

IV. For each of the above functions, determine if f(x) is (x 2) and whether it is (x 2).

V. Prove that f(x)= x4 + 9x3 + 4x + 7 is O(x4). Hint: Use the definition of big-O.

VI. Show (prove) that (x2 + 1)/(x +1) is O(x).

VII. Let k be a positive integer. Show (prove) that 1k + 2k +3k +...+ nk is O(nk+1). VIII. Give the smallest big-O estimate for the following functions:

a. (n2 + 8)(n+1) b. (n log n + n2)(n3 + 2) c. (n! + 2n)(n3 + log (n2 + 1)) d. (n3 + n2 log n)(log n + 1)(17 log n + 19)(n3 + 2)

IX. T is a set described using the two rules below: 1. (0,0)  T 2. If (m,n)  T then (m+1,n), (m+1,n+1), and (m+1,n+2) are in T

A. List 10 members of T. B. Prove that 2a ≥ b for all (a,b) in T.

X. S(2) = 1 S(2) = 2S(2) + 2

A. Write the sequence S(2) for k = 0, 1, 2, 3, 4, 5, 6 B. Try to get closed form (from part A) and prove by induction.

XI. Prove by induction (Note: your basis is > 0): a. 2n > n2 b. 3n < n!

Recommended publications