

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


(a) Use the recursion tree method to get a tight upper bound (i.e. big-O) on the solution to this recurrence (b) Now use annihilators (and a transformation) to get a tight upper bound on the solution to this recurrence. Show your work. (Note that your two bounds should match)
(a) Use the Master method to get a general solution to this recur- rence. (b) Now use annihilators (and a transformation) to get a tight upper bound on the solution to this recurrence. Show your work. (Note that your two bounds should match)
int f (int n){ if (n==0) return 0; else if (n==1) return 1; else{ int val = 6f (n-1); val = val - 9f (n-2); return val; } }
(a) Write a recurrence relation for the value returned by f. Solve the recurrence exactly. (Don’t forget to check it)
(b) Write a recurrence relation for the running time of f. Get a tight upperbound (i.e. big-O) on the solution to this recurrence.
int f (int n){ if (n==0) return 0; else if (n==1) return 1; else{ int val = 4f (n-1); val = val - 4f (n-2); return val; } }
(a) Write a recurrence relation for the value returned by f. Solve the recurrence exactly. (Don’t forget to check it) (b) Write a recurrence relation for the running time of f. Get a tight upperbound (i.e. big-O) on the solution to this recurrence.