Created
July 30, 2019 18:35
-
-
Save andylshort/d5dd2a8dc01f2622f989473dbfc99ccb to your computer and use it in GitHub Desktop.
Ackermann C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int Ackermann(int m, int n) | |
{ | |
if (m == 0) | |
{ | |
return n + 1; | |
} | |
else if (n == 0) | |
{ | |
return Ackermann(m - 1, 1); | |
} | |
else | |
{ | |
return Ackermann(m - 1, Ackermann(m, n - 1)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment