/** * Informatik II - FS2009
* Uebungsserie 4, Aufgabe 4
* * Computes the Ackermann function A(n,m) */ class Ackermann { // Create a stack structure for maximal 100 elements // (see Stack.java) Stack stack = new Stack(); /** * Iterative computation of the Ackermann function A(n,m) * * ...ADD YOUR COMMENTS HERE... * * @param n * @param m * @return */ public int ackermann( int n, int m ) { // Stack initialized with values n,m stack.push ( n ); stack.push ( m ); //_Iterative_ Calculation //...ADD YOUR CODE HERE... return m; } // end ackermann() public static void main( String args[] ) { Ackermann a = new Ackermann(); if(args.length != 2) { System.out.println( "Please enter 2 integer numbers "); System.out.println( "Example: java Ackermann 2 3" ); System.exit( 1 ); } int n = Integer.parseInt( args[0] ); int m = Integer.parseInt( args[1] ); System.out.println(a.ackermann(n,m) ); } }