3 Replies Latest reply: Mar 15, 2013 3:16 AM by gimbal2 RSS

    Recursive Methods

    997039
      Hi,

      I new to java and programming. I'm trying to make sure I have a good handle on how to write recursive methods.

      I'm looking for some simple problems that can be solved with a recursive method. I'm not so good with math so problems like generating the nth fibonacci number would be great.

      Thanks!
        • 1. Re: Recursive Methods
          baftos
          If you are new to programming and Java, I strongly recommend you don't focus too much on recursion. Recursive solutions are fascinating by their mathematical elegance and their computing inefficiency in most of the cases.
          For a more practical exercise, take a shot at listing all the files in a directory and all its subdirectories.
          • 2. Re: Recursive Methods
            rp0428
            >
            I new to java and programming. I'm trying to make sure I have a good handle on how to write recursive methods.

            I'm looking for some simple problems that can be solved with a recursive method. I'm not so good with math so problems like generating the nth fibonacci number would be great.
            >
            Are you new to searching the net?

            Just enter 'java tutorial recursion' into your favorite search engine and you will get thousands of hits that have problems, sample code and even youtube videos about recursion and how to use it.
            • 3. Re: Recursive Methods
              gimbal2
              rp0428 wrote:
              Are you new to searching the net?
              Its a more difficult skill to master than you'd think apparently. The fact that I spend at least an hour (but often more) a day performing research to solve my problems and to find answers to my questions makes me weird I guess.