1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Sedaia [141]
3 years ago
12

Compare Fibonacci (recursion vs. bottom up)

Computers and Technology
1 answer:
ipn [44]3 years ago
7 0

Answer:

C++ code explained below

Explanation:

#include<bits/stdc++.h>

#include <iostream>

using namespace std;

int FiboNR(int n)

{

int max=n+1;

int F[max];

F[0]=0;F[1]=1;

for(int i=2;i<=n;i++)

{

F[i]=F[i-1]+F[i-2];

}

return (F[n]);

}

int FiboR(int n)

{

if(n==0||n==1)

return n;

else

return (FiboR(n-1)+FiboR(n-2));

}

int main()

{

long long int i,f;

double t1,t2;

int n[]={1,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75};

cout<<"Fibonacci time analysis ( recursive vs. non-recursive "<<endl;

cout<<"Integer FiboR(seconds) FiboNR(seconds) Fibo-value"<<endl;

for(i=0;i<16;i++)

{

clock_t begin = clock();

f=FiboR(n[i]);

clock_t end = clock();

t1=double(end-begin); // elapsed time in milli secons

begin = clock();

f=FiboNR(n[i]);

end = clock();

t2=double(end-begin);

cout<<n[i]<<" "<<t1*1.0/CLOCKS_PER_SEC <<" "<<t2*1.0/CLOCKS_PER_SEC <<" "<<f<<endl; //elapsed time in seconds

}

return 0;

}

You might be interested in
What is the difference between a rendering engine and a browser engine?
Vlada [557]

Answer:

D) A rendering engine displays content on the screen and a browser engine coordinates user interface interactions.

Explanation:

The rendering engine will deal with all the HTML code and will generate an output based on its own rules for interpreting the code.  That's why different rendering engines will have different renditions of the same given HTML code. You can notice that in the acceptance of HTML5 and CSS3 tags, which are not universal yet.

The browser engine will deal with the user interface and all other features that make a browser a browser, relying on the rendering engine for the display.

That duality allows different browsers to use the same rendering engine, thus have similar outputs.

7 0
3 years ago
Read 2 more answers
Design a hierarchy of classes, where the Media superclass has the artistName and the mediaName as the common attributes. Create
zaharov [31]

Answer:

See attached file.

Explanation:

See attached file for detailed code.

Download txt
7 0
3 years ago
Four workers take an extra half-hour for lunch, at a cost of $14/ hour
Usimov [2.4K]

Answer:

whats the rest ?

Explanation:

whats the rest ?

8 0
4 years ago
the_____ tool is used to change the select text to capital letters or small letters (change case /grow font)​
solong [7]

Answer:

on word you can use shortcut "Shift+f3" to change uppercase lowercase and title case if that is what you are asking for

3 0
3 years ago
Quick Search lets you refine or narrow your search results using links on the right side of the screen. Do a search on nano-mate
Fofino [41]

Answer:

C. by topic.

D. by collection.

4 0
4 years ago
Other questions:
  • A user of the wireless network is unable to gain access to the network. The symptoms are:1.) Unable to connect to both internal
    6·1 answer
  • What is the most efficient way to include a space after each paragraph
    9·1 answer
  • The first time you save a document, which screen appears
    8·2 answers
  • What are the ethical implications of online social media after someone has died
    8·2 answers
  • How to cancel branly subscription??​
    8·1 answer
  • Part 1: For this assignment, call it assign0 Implement the following library and driver program under assign0: Your library will
    5·1 answer
  • Can maybe someone play with me on Over-watch on the Xbox?
    8·1 answer
  • An IP address specifically belongs to:
    10·1 answer
  • marion is an iot developer working for a large organization. why does his supervisor want him to stay informed about the network
    9·1 answer
  • if you want to clear a single file, what move instruction would you use? group of answer choices none of the choices file to wor
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!