briefly explained below 1

Are you pressed for time and haven’t started working on your assignment yet? Would you like to buy an assignment? Use our custom writing services for better grades. Even if your deadline is approaching fast, our writers can handle your task right when you need it. Our writers will complete your order from scratch and make sure it’s completely unique.


Order a Similar Paper Order a Different Paper

write a pseudocodes for the two c++ program’s below and execute them in a LaTeX overleaf.

1) fibonacci_Iterative_

#include <iostream>
using namespace std;

int fib(int maxFib){

long curr, currMinus2 = 1, currMinus1 = 1;
cout << “nfib 1 = ” << currMinus2 << endl;
cout << “fib 2 = ” << currMinus1 << endl;

for (int i = 3; i <= maxFib; i++){
curr = currMinus2 + currMinus1;
cout << “fib ” << i << ” = ” << curr << endl;
currMinus2 = currMinus1;
currMinus1 = curr;
}
return curr;
}
int main()
{
int myElement = 0;
long myResult;

while (myElement < 3){
cout << “nPlease enter an integer greater than 2: “;
cin >> myElement;
}

myResult = fib(myElement);

cout << “nnResult = ” << myResult << endl;
return 0;
}

2) fibonacci_recursive_

// Recursive solution for calculating the fibonacci series
// From HackerRank video

#include <iostream>
using namespace std;

long fib(long n) {
if (n <= 0) {
return 0;
}
else if (n==1) {
return 1;
}
else {
return fib(n-1) + fib(n-2);
}
}

int main()
{
long fibResult = fib(15); // Higher than 45 will be an exponentially long wait
cout << “nResult = ” << fibResult << endl;
return 0;
}

Writerbay.net

Do you need help with this or a different assignment? Even when your task is complicated and the deadline is in less than 2 days, you still have every chance to get a good grade for it. How? By completing the order form, you will get the finest custom-written assignment at an affordable price. We also deliver a number of services for free (e.g., revisions, editing, checking the text for authenticity). Use our paper writing service to receive effective help with your homework.


Order a Similar Paper Order a Different Paper