Question: I want the code in java for the devise lookup method for Ackermann which is the 3rd question. It is said that we need two
Ackermann's function is defined recursively for two non-negative integers M and N as follows: Ackermann( MN) N 1 if M- else if N 0 then Ackermann(M - 1, 1) else Ackermann(M1-1. Ackermann(M,N-1)) 1) Write a recursive version of this function, 2) On a piece of paper compute by hand the values of Ackermann for Ack(0.0), Ack(0,1), Acko,2), Ack(1,0), Ack 1.1), 3) Display a trace of the intermediate values for M and N for Ackermann function when M-2,N-2, and for M 3,N 2. A Ack( 1,2), Ack(2,0), Ack(2,1), and Ack(2,2). trace of Ackermann's function for M 3.N 2, requires about 541 calls to the method. The functional value is 29. A trace of M 2, and N 2, requires about 27 function calls and hasavalue of 7 1) Devise a table look-up method that shortens the process of computing the function values by storing intermediate results for Ackermann and using these values when they are available. Display the number of "hits" to the table look-up when doing the table look-up m
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
