Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. how many times in your life have you implemented recursive methods

how many times in your life have you implemented recursive methods

Scheduled Pinned Locked Moved The Lounge
62 Posts 45 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Vasily Tserekh

    I can count with the fingers of my hand the times I had to implement recursive methods in my life, so what was the fuzz all about when you are in school ant programming teachers tell you that that is the holy grail of programming!!! ps: i know that is important but most of recursive functions are implememnted and you only have to use them.

    J Offline
    J Offline
    jcmaida
    wrote on last edited by
    #53

    In compiler design, recursion is quite useful. It can get overly complicated though. For example: subroutine A and subroutine B are both recursive and call each other. You can see how complicated it can get tracing the execution path. Really not as bad it seems, but you better have your recursion hat on.

    1 Reply Last reply
    0
    • V Vasily Tserekh

      I can count with the fingers of my hand the times I had to implement recursive methods in my life, so what was the fuzz all about when you are in school ant programming teachers tell you that that is the holy grail of programming!!! ps: i know that is important but most of recursive functions are implememnted and you only have to use them.

      L Offline
      L Offline
      Leng Vang
      wrote on last edited by
      #54

      Recursive is what makes a computer useful. Recursive in theoretical computation is very useful and couldn't be easily done without it. Try some Lambda Calculus for example.

      1 Reply Last reply
      0
      • V Vasily Tserekh

        I can count with the fingers of my hand the times I had to implement recursive methods in my life, so what was the fuzz all about when you are in school ant programming teachers tell you that that is the holy grail of programming!!! ps: i know that is important but most of recursive functions are implememnted and you only have to use them.

        M Offline
        M Offline
        Moshe Katz
        wrote on last edited by
        #55

        In many functional languages, such as OCaml, recursion is the best way to write code that processes a list. There are certain situations in that language where recursion is faster and/or more efficient than iteration. I haven't used it for any major projects though.

        1 Reply Last reply
        0
        • V Vasily Tserekh

          I can count with the fingers of my hand the times I had to implement recursive methods in my life, so what was the fuzz all about when you are in school ant programming teachers tell you that that is the holy grail of programming!!! ps: i know that is important but most of recursive functions are implememnted and you only have to use them.

          T Offline
          T Offline
          TRK3
          wrote on last edited by
          #56

          I write them often enough -- but that's because the problems I'm trying to solve are best solved by recursive methods. The problem with teaching recursion in school, is that too often the examples you are given are examples that could just as easily (and often more easily and efficiently) be written as loops. So, you are shown the example, and your immediate reaction is: "Why would I ever want to do it that way?" And you, being a practicaly person who just wants to build useful things, quite naturally decide that there is no point to doing things recursively so you don't bother to learn it. Where, on the other hand, your academic minded professor is so stuck on the "mathematical beauty" of thing he can't be bothered with explaining the practical aspects of it. There are certain classes of problems (graphs, trees, parsing) where recursion is the natural way to solve the problem and where trying to do it in a loop is just painful.

          1 Reply Last reply
          0
          • V Vasily Tserekh

            I can count with the fingers of my hand the times I had to implement recursive methods in my life, so what was the fuzz all about when you are in school ant programming teachers tell you that that is the holy grail of programming!!! ps: i know that is important but most of recursive functions are implememnted and you only have to use them.

            S Offline
            S Offline
            SeattleC
            wrote on last edited by
            #57

            Lots of problems have easy-to-understand and easy-to-remember recursive solutions. It's good for a quick hack, and useful as a basis for the less-expensive iterative or dynamic programming version of the solution. The Holy Grail of recursive expressions is getting the compiler to automagically code the iterative realization of your easy-to-specify recursive solution. Some progress has been made in this regard, particularly in functional languages where practically everything is recursive.

            1 Reply Last reply
            0
            • V Vasily Tserekh

              I can count with the fingers of my hand the times I had to implement recursive methods in my life, so what was the fuzz all about when you are in school ant programming teachers tell you that that is the holy grail of programming!!! ps: i know that is important but most of recursive functions are implememnted and you only have to use them.

              M Offline
              M Offline
              Member 4608898
              wrote on last edited by
              #58

              I deal a lot with parsing so there is recursion and mutual recursion involved. If I use recursive descent, then I don't need to find a port of yacc or bison on the platform I'm using. It is a lot faster anyway since the scripts are generally correct so there is no need for good error messages that yacc is better at giving than recursive descent. I also use it for duplication on screens top, left, right and down and inserts, deletes and searches on home brew tree structures. Some structures are mutually recursive classes so that is quite a bit. All in all about 20 to 30 times in every company I've worked for so that is at least 200 times. It depends on what field you work in. If it is just controlling devices, you'll never need to use it.

              1 Reply Last reply
              0
              • V Vasily Tserekh

                I can count with the fingers of my hand the times I had to implement recursive methods in my life, so what was the fuzz all about when you are in school ant programming teachers tell you that that is the holy grail of programming!!! ps: i know that is important but most of recursive functions are implememnted and you only have to use them.

                M Offline
                M Offline
                Marbry Hardin
                wrote on last edited by
                #59

                A not insignificant number of times. It's not always appropriate, but for certain things like traversing trees as someone mentioned, it can save you a lot of ugly code otherwise.

                1 Reply Last reply
                0
                • R realJSOP

                  It seems like I do it over and over again... JSOP's Recursive Rule of Recursion: "No matter where you are, that's where you're at."

                  ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                  -----
                  You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                  -----
                  "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

                  M Offline
                  M Offline
                  mayjune56
                  wrote on last edited by
                  #60

                  it's classical !

                  1 Reply Last reply
                  0
                  • V Vasily Tserekh

                    I can count with the fingers of my hand the times I had to implement recursive methods in my life, so what was the fuzz all about when you are in school ant programming teachers tell you that that is the holy grail of programming!!! ps: i know that is important but most of recursive functions are implememnted and you only have to use them.

                    D Offline
                    D Offline
                    Dulchase
                    wrote on last edited by
                    #61

                    A few times when I worked on data structures, half of which ended in oveflown stacks. Then I gave up completely. :)

                    1 Reply Last reply
                    0
                    • L lewax00

                      Linear algebra is another one. Don't use it at all for most things, but good luck doing 3D graphics without it. It's good to have a varied tool kit, just in case.

                      V Offline
                      V Offline
                      Vasily Tserekh
                      wrote on last edited by
                      #62

                      I am a 3D programmer and I tell you that you almost dont need recursion for 3D programming, I even made an iterative method for terrain following when all tutorials said otherwise, and works faster

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups