Results 1 to 7 of 7

Thread: what's so bad about recursion?

Threaded View

  1. #1

    Thread Starter
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Resolved what's so bad about recursion?

    I've read in books, and heard from other people; that recursion is a terrible decision. I sort of agree in certain situations. But say you have something like this... What's so bad about using recusion?

    Code:
    int i = 0;
    
    if (i >= 10)
    {
    }
    else
    {
    System.out.println(i + "");
    i++;
    }

    vs some looping like this:


    Code:
    int i = 0;
    
    while (i != 10)
    {
      System.out.println(i + ""); 
      i++;
    
    }

    I just don't understand why recursion is a worse decision than choosing a looping or iterative type structure...



    <Moderator added green checkmark in the first thread>
    Last edited by NoteMe; Feb 17th, 2005 at 07:12 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width