The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 304 Weeks Ago, 1 Day Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
Visual studio project needed with C++ code
Â
Instructions:
Â
I've put together some rough code already and just need it tweaked and reviewed to fit the criteria of this project or can create own. Please review .cpp file.
Â
Modify the Acker function so that it utilizes memoization. See if you can get your modified function to calculate the following values:
Acker(3,20) = 8388605
Acker(4,0)Â Â = 13
Acker(4,1)Â Â = 65533
You almost certainly will need to change the default Stack Reserve Size to about 1 billion. This Project Properties option is found under Configuration Properties | Linker | System.
Â
Â
Â
//Define Acker Function
int Acker(int m, int n)
{
//Declare a variable
int resultValue;
//If m is equal to 0
if (m==0)
//Assign n+1 as result value
resultValue = n+1;
//if n value is equal to 0
else if (n==0)
//Recursively call the result Value
resultValue = Acker(m-1, 1);
//Return the result
return resultValue;
}
//Include Header files
#include
using namespace std;
//Define function Acker
int Acker(int m, int n)
{
//Declare variable
int resultValue;
//If m is equal to 0
if (m==0)
//Assign n+1 as a result value
resultValue = n+1;
//If n value is equal to 0
else if (n==0)
//Recursively call the result Value
resultValue = Acker(m-1, 1);
//Else statement
else
//Recursively call the result Value
resultValue = Acker(m-1, Acker(m, n-1));
//Return the result
return resultValue;
}
//Main function
int main()
{
//Print Answer
cout<<"Answer:"<
//Pause Console Window
system("pause");
//Return statement
return 0;
}
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly