Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. (10 points) Write an efficient iterative (i.e., loop-based) function Fibonnaci(n) that returns the nth Fibonnaci number. By definition Fibonnaci(0) is 1, Fibonnaci(1) is 1,

image text in transcribed

1. (10 points) Write an efficient iterative (i.e., loop-based) function Fibonnaci(n) that returns the nth Fibonnaci number. By definition Fibonnaci(0) is 1, Fibonnaci(1) is 1, Fibonnaci(2) is 2, Fibonnaci(3) is 3, Fibonnaci(4) is 5, and so on. Your function may only use a constant amount of memory (i.e. no auxiliary array). Argue that the running time of the function is (n), i.e. the function is linear in n. 2. (10 points) Order the following functions by growth rate: N, \N, N1.5, N2, N log N, N log logN, N log2 N, N log (N2), 2/N, 2V, 2N/2, 37, N2 log N, N3. Indicate which functions grow at the same rate. 3. (10 points) Compute the running time T(n) of the program fragment below and provide an analysis of the running time (Big-Oh notation will do). For convenience, assume that operations inside for loops take constant time, i.e. (1) sum = 0 for( i-0; i 0, what is the minimum value of n such that T1 (n) <>

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions

Question

WHAT IS AUTOMATION TESTING?

Answered: 1 week ago

Question

What is Selenium? What are the advantages of Selenium?

Answered: 1 week ago

Question

Explain the various collection policies in receivables management.

Answered: 1 week ago