Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Tail Recursion in Java

Name: !double-shot-of-JAVA 2009-07-20 18:48

Who says tail recursion is IMPOSSIBLE in Java?

private double ave2Int(int larger, int smaller)
{
     int temp;
     if(larger < smaller)    
     {
         temp = smaller;
         smaller = larger;
         larger = temp;
     }
     if(larger == smaller)
         return(larger);
     if(larger == smaller + 1)
         return(larger - .5);
     else
         return(ave2Int(larger - 1, smaller + 1));
}

Name: Anonymous 2009-07-20 18:54

>>1
Nobody said this. What are you talking about. Java is anus complete.

Name: Anonymous 2009-07-20 19:05

>>1
But is it optimized?

Name: Anonymous 2009-07-20 20:29

>>3
Not the point. Plus its about 1.5/1 speed performance ratio to C.

Name: Anonymous 2009-07-20 20:33

>>4
That is the point, if you don't want stack overflow.

Name: !double-shot-of-JAVA 2009-07-20 21:05

>>5
You know what? I'm gonna program an array that does the work of stack space. That way if it gets too big, you can just reallocate more memory to the array.

Name: > 2009-07-20 21:40

>>1
This is not optimized. Here, let me give you some help.

private double ave2Int(int larger, int smaller)
{
    return (larger+smaller)/2;
}

Name: Anonymous 2009-07-21 1:03

>>7
ponezored

Name: Anonymous 2009-07-21 3:21

Fuck you assholes

Name: Anonymous 2010-12-26 22:57

Name: Anonymous 2011-02-02 22:59

Name: Anonymous 2011-02-03 6:42

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List