Does anybody know the time complexity to compute the ackermann function ack(m,n) in big-O notation or to which complexity class it belongs? Just Ack(3, n) would be also sufficient. I read somewhere it is NONELEMENTARY?
Thanks.
Code Snippet:
public class Ackermann {
public static int ackermann(int n, int m) {
if (n == 0)
return m + 1;
else if (m == 0)
return ackermann(n - 1, 1);
else
return ackermann(n - 1, ackermann(n, m - 1));
}
}
ack(3, n)
using your code is exponential - you can calculate the exact number of calls it'll make from oeis.org/A074877 – Sonjasonnet