19
askerr
8y

I remember when I was first learning recursion, i thought whoever thought of it must've been on some kickass drugs because it all sounded like sorcery. Just solved my first problem at work that recursion actually made simpler. Does that make me a wizard?

Comments
  • 0
    Yes :)
  • 0
    Depends, would it have been easier to solve with a loop?
  • 2
    @projektaquarius no, unless you prefer to loop through tree nodes that is.
  • 2
    @askerr that is an acceptable use of recursion, welcome to the wizard club.
  • 0
    there is much more difference between recursion and iteration programming. All problem can't be solved with it.
  • 0
    @Jung yes, but many, if not most, uses of recursion in production code are programmer hubris rather than actually necessary. At least in my experience. Kind of like the ternary operator.
  • 0
    Recursion can always be made into a more efficient iterative statement. You only run into problems when comverting a recursive definition in one language to an iterative statement in another language, as some very specific cases would blow up your runtime.
  • 0
    @Jung you can convert ANY recursive problem into an iterative one.
  • 0
    When I first learnt recursion I googled it, and it asked if I meant recursion. I didn't get it.
  • 0
    @bluefirex
    it can be converted. it may be long in size but it is not impossible.
Add Comment