Compare the number of operations and the cpu time

Assignment Help C/C++ Programming
Reference no: EM13938567

I need help to writing a program "VC++.net" with the specified input and output.

Use a computational program or programs you have written to do the following exercises.

Given any non-negative integer n,

a.Find the nth Fibonacci number using iteration.

b.Find the nth Fibonacci number using recursion.

c.Compare the number of operations and the CPU time needed to compute Fibonacci numbers recursively vs. that needed to compute them iteratively.

Maybe these pseudocodes been helpful;

A Recursive Algorithm for Fibonacci Numbers.

Procedure fubonacci(n: nonnegative integer)
If n = 0 then Fibonacci(0) := 1
else if n = 1 then fiponacci(1) :=1
else fibonacci(n) := Fibonacci (n - 1) + fibnacci(n - 2)

An Iterative Algorithm for computing Fibonacci Numbers.

Procedure iterative Fibonacci (n : nonnegative integer )
If n=0 then y:=0
else
begin
x := 0
y := 1
For i := 1 to n - 1
begin
z := x + y
x := y
y := z
end
end

Reference no: EM13938567

Questions Cloud

Analysis based on a self-designed fictitious study : For this assignment you will undertake an analysis based on a self-designed fictitious study that utilizes statistical analyses. You will first develop a fictitious problem to examine. It can be anything.
Stockholm conference on the human environment : The 1972 Stockholm Conference on the Human Environment had three major products: The Action Plan to protect the global environment; the United Nations Environment Programme and the related Environment Fund; and the Stockholm Declaration on the Hum..
Describe pathological processes involved in degeneration : Describe the pathological (disease) processes involved in degeneration and herniation and of the vertebral disks and how these disease processes represent an alteration from the normal physiology of the vertebral column.
Why did the controller compute depreciation expense : Why did the controller compute depreciation expense on the financial statements as he or she did? What are the possible consequences of the controller's decision on the amount of depreciation expense?
Compare the number of operations and the cpu time : Compare the number of operations and the CPU time needed to compute Fibonacci numbers recursively vs. that needed to compute them iteratively.
The program outputs the area of the floor in square feet : a) Write a Pseudocode to represent the logic of a program that allows the user to enter values for the width and length of a room's floor in feet. The Program outputs the area of the floor in square feet.
State the research approach to investigate the issue : My assignment is about a research proposal of my own chosen subject. Mine is: (an evaluation of the nurse to patient ratio for the registered nurses working in stroke wards in Australian hospitals and it's impact on patient's risk of morbidity and..
Write a pseudocode to represent the logic of a program : Write a pseudocode to represent the logic of a program that allows the user to enter two values. the program outputs the product of the two values.
How drug tolerance and conditioning may factor into outcome : Jim has taken heroin for the past 5 years. One day, Jim and Jack go out and both use large quantities of heroin. Although both did the same amount of drugs, Jack dies from an overdose. Discuss how drug tolerance and conditioning may factor into th..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Design and implement a c++ program for find friends

MCS2514Pgm1- Design and implement a C++ program that will help find friends according to a defined method. In particular, your program will find and display the ten people in database who answered a set of survey questions closest to what the user..

  Square root of a number n

USING C++ the square root of a number N can be approximated by repeated calculation using the formula NG=.5(LG+N/LG) where NG stands for next guess and LG stands for last guess

  Pre and post increament and decrement operators

We are going to overload the following operators in the fract class- pre and post increament (++) and decrement (--) operators

  Taskwrite a bouncing ball video game the balls bounces

taskwrite a bouncing ball video game. the balls bounces within the screen where the two horizontal walls are fixed. the

  What is output from the following segment of code

What is output from the following segment of code? (note: this is a code segment, not a complete program.) What is output from the following code segment

  Code for the process management simulation

Its C++ in a linux environment for Process Management Simulation

  Implement a string class

Implement a String class. Each object of this class will represent a character string. Data members are the length of the string and the actual character string. In addition to constructors, destructor, access functions, and a print function, incl..

  Write a function that permanently swaps two floats

Write a function that permanently swaps two floats using references.

  Determines the access privillege of a derived class

The base class access specifier determines the access privillege of a derived class to its base class

  Write a function named flattens

Write a function named flattens that takes a two-dimensional array of integers with 100 rows and 200 columns and returns a vector that contains all of the array's elements.

  Write a c program that display the hexadecimal equivalent

Write a C program that will accept a hexadecimal number as input, and then display a menu that will permit any of the following operations to be carried out: (a) Display the hexadecimal equivalent of the one"s complement.

  A text file students.txt contains student records

A text file students.txt contains student records (name, date of birth, and GPA). Write a program that reads student records from students.txt and creates an array of student structures

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd