Question: Perform a box trace for Akermans. 1)Do a box trace of the Ackerman function with M = 0, N=1 2) ATTEMPT a box trace of

Perform a box trace for Akermans.

1)Do a box trace of the Ackerman function with M = 0, N=1

2)ATTEMPT a box trace of the Ackerman function with M = 1, & N = 2

Ackermans function is often used to test the efficiency with which a computer performs recursion it is defined as :

Acker (M, N) where M, N >= 0

result = N+1 if M = 0

result = Acker ( M-1, 1) if N = 0

result = Acker ( M 1, Acker ( M, N -1) ) if M > 0 & N > 0

An implementation is:

public static int Acker( int m, int n) {

int result;

if ( m = =0) result = n + 1;

else if ( n = = 0) result = Acker( m -1, 1);

else result = Acker( m 1, Acker (m, n-1));

return result;

}// end Acker

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!