Briefly explained below.

I’m trying to learn for my Computer Science class and I’m stuck. Can you help?

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;
}

  • Best Nursing Writers
  • Best Nursing Writing Company
  • Buy a Nursing Essay
  • Capstone Project Writing Services
  • CHEAP NURSING ASSIGNMENTS
  • Cheap Thesis Writing Nurses
  • Community Health
  • Course Work
  • Document Formatting Services
  • Family Health Nursing
  • Fundamentals of Nursing
  • Geriatrics
  • GRADUATES CAPSTONE PROJECT
  • Health & Human Ecology
  • Human Bio-Sciences
  • Human Physiology
  • Industry Warning and Guidance!
  • Legit Nursing Writing Company
  • Medical Writing Services
  • Mental Health & Psychiatry
  • Nursing Assignment Help
  • Nursing Bibliography
  • Nursing Case Study
  • Nursing Coursework Help
  • Nursing Dissertation Writing Services
  • Nursing Essay/Personal Statement
  • Nursing Essays
  • Nursing Freelance Writers
  • Nursing Practitioners
  • Nursing Report Writing
  • Nursing Surgery
  • Nursing Term Paper Writing
  • Nursing Thesis Writing

©  2020 Nursingpaperspros.com