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.
  • D Dr Walt Fair PE

    When you go back, it's deja vu all over again.

    CQ de W5ALT

    Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

    R Offline
    R Offline
    Ravi Bhavnani
    wrote on last edited by
    #16

    That reminds me... /ravi

    My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

    1 Reply Last reply
    0
    • D Dr Walt Fair PE

      Lots!! If you use Prolog or any of the functional languages, it's extremely useful, fast and efficient to use (tail) recursion. In fact, I can hardly imagine programming anything in those languages without recursion.

      CQ de W5ALT

      Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

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

      Hate prolog at so many levels that I thank god I dont need to use it in my normal life

      1 Reply Last reply
      0
      • D Dr Walt Fair PE

        When you go back, it's deja vu all over again.

        CQ de W5ALT

        Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

        Mike HankeyM Offline
        Mike HankeyM Offline
        Mike Hankey
        wrote on last edited by
        #18

        In my case it's veja du. Someplace I've never been and never want to go!

        VS2010/Atmel Studio 6.0 ToDo Manager Extension
        Version 3.0 now available. There is no place like 127.0.0.1

        1 Reply Last reply
        0
        • A AspDotNetDev

          I imagine some developers come across recursion more often than others. For example, I sometimes deal with recursion when writing code that traverses the file system, but I don't do that very often. Video game developers might do it when they handle BSP, closest path algorithms, collision detection, and so on. And just because you don't use it often does not mean it's not incredibly useful. Some problems might seem insurmountable without recursion. You might also seldom use trigonometry, but when you need it you really need it.

          Thou mewling ill-breeding pignut!

          L Offline
          L Offline
          lewax00
          wrote on last edited by
          #19

          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.

          A V 2 Replies Last reply
          0
          • Mike HankeyM Mike Hankey

            Where ever you go, there you are.

            VS2010/Atmel Studio 6.0 ToDo Manager Extension
            Version 3.0 now available. There is no place like 127.0.0.1

            R Offline
            R Offline
            realJSOP
            wrote on last edited by
            #20

            I feel more like I do now than I did a while ago.

            ".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

            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
              Lost User
              wrote on last edited by
              #21

              Vasily Tserekh wrote:

              I can count with the fingers of my hand the times I had to implement recursive methods in my life

              You're twenty? :) I ran out of fingers at my first employer.

              Bastard Programmer from Hell :suss:

              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.

                A Offline
                A Offline
                AspDotNetDev
                wrote on last edited by
                #22

                I don't get to use that very often, as I took a class called "Linear Algebra" in college and now I have no idea what linear algebra is. :)

                Thou mewling ill-breeding pignut!

                L 1 Reply Last reply
                0
                • A AspDotNetDev

                  I don't get to use that very often, as I took a class called "Linear Algebra" in college and now I have no idea what linear algebra is. :)

                  Thou mewling ill-breeding pignut!

                  L Offline
                  L Offline
                  lewax00
                  wrote on last edited by
                  #23

                  Well the name makes no sense to me (I guess its because it has to do with linear systems or something like that) but that's the one with the matrices. Very necessary for 3D applications. But most apps aren't 3D, and outside of that and scientific simulation I don't think it gets used for anything.

                  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.

                    P Offline
                    P Offline
                    Paul M Watt
                    wrote on last edited by
                    #24

                    Many times, it's a useful type of solution to know that it exists. One of the key concepts they really focused on when I was in college was the "Divide and Conquer" approach in programming. It is very simple to illustrate this concept with recursion and I think that is why it's demonstration is so pronounced. One thing to consider, is that a tail-recursive algorithm can be re-written into a loop that resides in a single function. How many functions have you written that only contain a loop and could have just as easily started out as a recursive implementation?

                    All of my software is powered by a single Watt.

                    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 4194593
                      wrote on last edited by
                      #25

                      Many. Dave.

                      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.

                        P Offline
                        P Offline
                        PIEBALDconsult
                        wrote on last edited by
                        #26

                        I don't think I ever have in the real world, but maybe once. Certainly did in college, and in some games.

                        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.

                          I Offline
                          I Offline
                          Ingo
                          wrote on last edited by
                          #27

                          Wrong teachers, I think. My Prof told us, that there is an iterative solution for every recursive algorithm and that it is better to use the iterative one in 99.99% of all cases. Yet I didn't found the case where the recursive one is better. Perhaps faster to programm because you don't need to think about it, perhaps acceptable because it's needed just one time. :rolleyes:

                          ------------------------------ Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.

                          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.

                            G Offline
                            G Offline
                            Gary Wheeler
                            wrote on last edited by
                            #28

                            Almost every time I've had to deal with a hierarchical data structure, which has been fairly often. I don't understand the big deal. Recursion in programming is like ketchup on a hamburger. Whether you use recursion or iteration is largely a matter of personal taste.

                            Software Zen: delete this;

                            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.

                              Kornfeld Eliyahu PeterK Offline
                              Kornfeld Eliyahu PeterK Offline
                              Kornfeld Eliyahu Peter
                              wrote on last edited by
                              #29

                              Countless. I event made recursion is SQL... However today I use a better way to implement the idea of recursion - faster and lighter...

                              "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

                              R 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.

                                A Offline
                                A Offline
                                Alberto Biasiutti
                                wrote on last edited by
                                #30

                                I used to write recursive methods, then I took an arrow to the knee.. I've been a developer just for a couple of years by now, but I actually never used recursive methods yet.

                                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.

                                  Y Offline
                                  Y Offline
                                  YvesDaoust
                                  wrote on last edited by
                                  #31

                                  From my point of view, recursion can indeed be considered the Holy Grail of programming, as it relates to a very general technique of problem solving: you solve an instance of a problem by solving one or more smaller instances of the same problem. In programming, this is implemented by iteration in the simple cases and recursion in the general ones. By example, in Straight insertion sort, assume you have sorted the N-1 first elements, you pick some unsorted element and insert it where should, yielding a sort of the N elements. Sorting N elements is done from sorting N-1 elements, iteratively. In MergeSort, you sort two subarrays of N/2 elements and then merge them. The natural way to implement that is by recursion, solving an N problem from two N/2 problems, themselves from four N/4 problems... There's nothing as powerful as breaking a problem into subproblems. I use recursion on all these occasions where the Divide & Conquer approach is fruitful, i.e. when the algorithm shapes as a tree traversal. Among them are combinatorial optimization problems, using breadth-first, depth-first or iterative-deepening strategies. Like root finding by coarse to fine approaches, error correction in Verterbi, split & merge techniques for paralellization... Other occasions to use recursion is when the data structures in use are recursive by nature, such as binary or k-ary trees used in dictionaries, graphs for numerous purposes, k-D trees for fast geometric searches, abstract syntax trees in parsing... Obviously, if you never deal with algorithmics explicitly, chances are low that recursion will be of any help to you.

                                  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.

                                    J Offline
                                    J Offline
                                    jsc42
                                    wrote on last edited by
                                    #32

                                    Last time: Yesterday afternoon (code to sort out message replies into a correct hierarchy - each reply could have any number of sub-replies; each sub-reply could have any number of sub-sub-replies etc). OK, it is not a tool that I use every day, but it is essential to have it in your armoury. Same as a carpenter might not need a router every day; but there are times when it is useful.

                                    1 Reply Last reply
                                    0
                                    • D DaveAuld

                                      Good question, check out the thread here[^].

                                      Dave Find Me On: Web|Facebook|Twitter|LinkedIn


                                      Folding Stats: Team CodeProject

                                      J Offline
                                      J Offline
                                      jsc42
                                      wrote on last edited by
                                      #33

                                      Unfortunately, that is not recursion. It is an infinite iteration.

                                      F 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
                                        Michael Kingsford Gray
                                        wrote on last edited by
                                        #34

                                        At a guess/judgment, maybe over 300 distinct instances. (Not re-use of my library code) Or maybe more.

                                        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.

                                          G Offline
                                          G Offline
                                          gr8gonzo
                                          wrote on last edited by
                                          #35

                                          Written a fair amount of recursive methods/functions. I do it a lot for file-processing code (things that have to recurse into subfolders and then into their subfolders, etc...), or almost any situation that uses a hierarchy.

                                          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