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

  Analyze a basic set of requirements for a problem

Create the main bank program. Note that you can create the main bank program in the main function or you can try to create another class for the main bank program.

  Classes and objects are the basic concepts of

question 1. list three debugging techniques within the debugger that can be used to locate logical error in the java

  Find maximum velocity and maximum acceleration

Find maximum velocity and maximum acceleration - Write a general function that can be used to find the maximum of any array. Call this function twice in order to find maximum velocity and maximum acceleration.

  Write a program that creates an array of 200 random numbers

Write a program that creates an array of 200 random real numbers between 0 and 200.  Using the statistics library, calculate and output the following: mean, median, variance, standard deviation, maximum value, and minimum value.

  Clears the screen

Assignment: Write a script that meets the following requirements:•Clears the screen•Creates the menu displayed below with any additional formatting you may desire•Prompts the user to choose a menu option•Assigns the value chosen by the user to the va..

  Object oriented app development

Object Oriented App development

  Take four unsigned char bytes and combine

Take four unsigned char bytes and combine them into a single integer type. You will needed shifts and one of the logical bit operators.

  State private portion of class to model the item

In c++ state the private portion of a class to model the given item: a class Date for dates consisting of a month, day and year. a class PhoneNumber for a telephone numbers consisting of area code, local exchange, and number.

  Calculate the volume flow rate in cubic feet

Write a program to calculate the volume flow rate in cubic feet per second of water flowing through a pipe of diameter d in inches and a velocity of v feet per second. The formula for the flow rate is given by: Where area = ?d^2 / 4 equation in sq..

  Write a program which has a base process which communicates

write a program which has a base process which communicates with child processes acting as bombers that it

  Applications presenting room booking

Write a windows applications presenting room booking. Add XML serialization to the application.Define a class Room that contains private information for the name, the size, the number of people than it can hold, booked/free, and the name of booker..

  Determining the total number of employees

Write a computer program to print a report with employee name and total salary for those employees whose total salary is more than 10,000. Total Salary = BASIC + HRA. At the end, the program should also print the total number of employees whose to..

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