question on HyperOperation
Posted
by davit-datuashvili
on Stack Overflow
See other posts from Stack Overflow
or by davit-datuashvili
Published on 2010-05-29T14:45:51Z
Indexed on
2010/05/29
14:52 UTC
Read the original article
Hit count: 163
algorithm
i am trying to solve following recurence program
http://en.wikipedia.org/wiki/Hyper_operator
here is my code i know it has mistakes but i have done what i could
public class hyper{
public static int Hyper(int a,int b,int n){
int t=0;
if ( n==0)
return b+1;
if ((n==1) &&(b==0))
return a;
if ((n==2) && (b==0))
return 0;
if ((n>=3) && (b==0))
return 1;
t=Hyper(a,b-1,n);
return Hyper (a,t,n-1);
}
public static void main(String[]args){
int n=3;
int a=5;
int b=7;
System.out.println(Hyper(a,b,n));
}
}
please help
© Stack Overflow or respective owner