Labs Homeworks |
## Lab1## Lab 1: Fibonacci Series ( Due Wed 24th Jan; only during your lab section!)## Part 1:Implement two separate programs that generate the n-th Fibonacci number. The programs should both take n as command line input. The first algorithm one should implement the recursive algorithm ( You should measure the time it takes for each of these versions (use for example, the Finally, create a table of all your results and plot (using for example, the ## Part 2:Now verify that fib2 is indeed quadratic time. Run fib2 and record the time on the following values of n: 2^10, 2^12, 2^14, 2^16, 2^18, 2^19 If it takes more than 20 mins on your machine to compute 2^19, then drop the last value above. For this part you can appreciate the fact that Python has native arbitrary precision integer arithmetic. Otherwise, the values of F(n) would easily exceed the 64 bit word size and cause overflow. Plot the time of fib2 versus n. ## GradingYour code must be implemented in Python. To get full credit, you must show your code, output, and plots to the TA and/or the undergrad mentors. Make sure that your grade is recorded in the official sheet. The lab will be graded according to the rubric outlined on the syllabus. |

Page last modified on January 17, 2018, at 05:31 PM