Purchase Solution

Fibonacci Number Visual C++ Recursion Iteration Runtime

Not what you're looking for?

Ask Custom Question

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
x := 0
y := 1
For i := 1 to n - 1
z := x + y
x := y
y := z

Please attention
This program must run in the Visual C++.NET. please the whole project included in the attached Zip file.
Please write simple code that be understandable for me

Thank you

Purchase this Solution

Solution Summary

In this solution you will learn how to find Fibonacci numbers through
a) Recursion and
b) Iteration

Solution Preview

Please see the attached fibonacci.zip
It contains the complete VC++ project folder along with the source code and executable file.
This is just one way of doing it. Ofcourse as a student you need to develop your own way of completing this. In anticipation of a ...

Purchase this Solution

Free BrainMass Quizzes
Basic Networking Questions

This quiz consists of some basic networking questions.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

C# variables and classes

This quiz contains questions about C# classes and variables.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.