This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Return fib1(n-1) + fib1(n-2); Iterative algorithm: fib2(n) If n = = 0 or 1 Return 1 Else prev = temp =1; For I = 2 through n do prev2prev = prev; prev=temp; temp = prev+prev2prev; Return temp; Implement these two algorithms. Run them with increasing input n and find out what happens with the run times. Optionally you may like to measure the run time of each of the programs and plot them against increasing n. Submission: source codes and a few lines of description regarding the run times. Graduate class: 4. Prove that if f(n) = Θ (g(n)), then g(n) = Θ (f(n))....
View Full Document
This note was uploaded on 02/10/2012 for the course CSE 5211 taught by Professor Dmitra during the Spring '12 term at FIT.
- Spring '12