Skip to content

Commit

Permalink
ackerman alg in go
Browse files Browse the repository at this point in the history
  • Loading branch information
paulborile committed Sep 11, 2017
1 parent 6ffb53e commit d1c5c5d
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions ack.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package main

func main() {
ack(3,12);
}


func ack ( m int, n int) int {
if ( m == 0 ) {
return ( n + 1 )
} else {
if ( n == 0 ) {
return ack ( m - 1 , 1 )
} else {
return ack ( m - 1 , ack ( m , n - 1 ))
}
}
}


/*
int a;
main()
{
int x;
a = ack (3,12);
}
int ack ( int m , int n )
{
if ( m == 0 ) return ( n + 1 );
else
if ( n == 0 ) return ack ( m - 1 , 1 );
else return ack ( m - 1 , ack ( m , n - 1 ));
}
*/

0 comments on commit d1c5c5d

Please sign in to comment.