These problems total to 130 points.
For the problems from Rosen 6th ed. 3.2, your answers should be based upon the definitions of O(), Ω(), and Θ(). You may use either the definitions in the textbook or those that I gave in class.
When providing recurrence equations, always provide an explicit base case, even though it is common practice to leave that implicit.
(10 points) Rosen 6th ed. 3.2 #24d
Show that log2(x2+1) is Θ(log2 x).
(10 points) Rosen 6th ed. 3.2 #26
Show that if f(x) and g(x) are functions from the set of real numbers to the set of real numbers, then f(x) is O(g(x)) if and only if g(x) is Ω(f(x)).
(5 points) Rosen 6th ed. 3.2 #36
Suppose that f(x) is O(g(x)). Does it follow that 2f(x) is O(2g(x))?
(5 points) Find a closed form for ∑k=i…j (3k2-k+1).
(5 points) Consider the problem of checking whether all the elements in a given array are distinct. The following is an algorithm for this:
for i = 0 to n-2
for j = i+1 to n-1
if A[i]=A[j] return false
return true
Write the summation formula for the maximum number of comparisons, and find its closed form.
(10 points) Show that ∑k=0…∞ k2xk = x(1+x)/(1-x)3 for 0<|x|<1.
(10 points) Rosen 6th ed. 4.1 #10a-b
(10 points)
Suppose that you have an unlimited supply of red, white, blue, green, and gold poker chips, which are indistinguishable except for color. Write recurrence equations defining sn, the number of ways to stack n≥0 chips with no two consecutive red chips. Briefly explain your answer.
(You are not asked to solve for a closed form, although you should be able to.)
(30 points — 5 points each parts a and c, 10 points each parts b and d) Rosen 6th ed. 7.2 #46abcd, reworded
Suppose that there are two goats on an island initially. The number of goats on the island doubles every year by natural reproduction, and some goats are either added or removed each year.
On another island, we again start with two goats and double their number annually via reproduction. But we also remove n goats during the nth year for each n≥3.
(25 points — 10 points each parts a and c, 5 points part b) A variation of Rosen 6th ed. 7.3 #18
Suppose that each person in a group of n people votes for exactly two people from a slate of candidates to fill two positions on a committee. The top two finishers both win positions as long as each receives more than n/2 votes.
(10 points) Rosen 6th ed. 7.3 #22b
Suppose that the function f satisfies the recurrence relation f(n) = 2f(√n) + log n whenever n is a perfect square greater than 1 and f(2)=1.
Find a big-O estimate for f(n). [Hint: Make the substitution m=log n.]