This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: HW # 2 COP 3530 Spring 11 CISE Dept. UF TAs for this assignment: Ravi, Ferhat Instructor: Manu Sethi Due: Mon, Jan 31, 2011 Instructions: You have to submit the hardcopy of everything as well as submit all the programs online via sakai. The hadcopies should be submitted to the instructor in the beginning of the class. Everything should be typed or legible if handwritten. All the program numbers mentioned are available at the books website, the link to which is mentioned in the top most line of the resources page. You need to write the codes for problems 1 and 6. You dont need to write templatized codes for this assignment. Each of these questions will have separate header files named hw2 prob1.h and hw2 prob6.h. However, there would be only one makefile that should need to submit. This makefile would compile programs 1 and 6 both and make a separate binary file for each. The name of the binaries will be: hw2prob1 and hw2prob6. You will also submit a textfile called README in which you can give any instructions to the TAs/graders. This README file will be a text file but does not has any extension to it. No further deadline extensions will be given this time. 1. (Chapter 1, Q20, modified) a. Write a recursive function to compute Fibonacci number g G . b. Show that your code for part (a) computes the same g more that once when it is invoked to compute g G for any > 2. c. Write a non recursive function to compute the Fibonacci number g G . Your code should compute each Fibonacci number just once. d. Write a function main from which you will call both your functions. Call your functions to compute the values of g G for = 10, 20,30, 40 50 . Compare the time differences in computing these Fibonacci numbers using both your functions. Report the times in a table. e. In class we discussed that the Time complexity of calculating the th Fibonacci number follows the same recursion as the recursion for obtaining the nth Fibonacci number itself....
View
Full
Document
This note was uploaded on 01/15/2012 for the course COP 3530 taught by Professor Davis during the Summer '08 term at University of Florida.
 Summer '08
 Davis
 Algorithms, Data Structures

Click to edit the document details