Skip to content

Instantly share code, notes, and snippets.

@zaersk
Created August 30, 2014 22:37
Show Gist options
  • Save zaersk/3aed52da80a907ea8607 to your computer and use it in GitHub Desktop.
Save zaersk/3aed52da80a907ea8607 to your computer and use it in GitHub Desktop.
Ackermann
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