Created
August 30, 2014 22:37
-
-
Save zaersk/3aed52da80a907ea8607 to your computer and use it in GitHub Desktop.
Ackermann
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
func ackermann(m:Int, n:Int) -> Int { | |
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