Question: **************************** Implement in C++ Question (2): The ackermann function is one of those very difficult functions to compute and it's a prime example of non-primitive
**************************** Implement in C++

Question (2): The ackermann function is one of those very difficult functions to compute and it's a prime example of non-primitive recursive functions, meaning it can't be de-recursed and rewritten into a loop The naive recursive implementation suffers problems starting with ack(4,1) and at the time of writing on a machine with a 4.2GHz base CPU clock speed and 3200GHz 32GBs of DDR3 RAM is not computable without further optimizations or settings applied. The ackermann function is described using the equation below. (n+1 m=0 ack(m,n)= ack(m-1,1) m> n=0 ack(m-1,ack(m,n-1)) m>0 n>0 You are required to 1. Describe why the base Ackermann function is so heavy to compute 2. Write an optimization to make it's calculation more efficient and possible for arguments starting Ack(4,1) and above Inputs: 2 integers m & n where m & n >= 0 Output: ack(m, n) Sample Inputs: 33 41 Sample Outputs: 61 65533
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
