Recursion is one of my favorite techniques we have learned so far. It's efficient, clean, and simple enough for me to understand yet challenging enough to interest me. I enjoy being able to fit the entirety of one function within one line. It makes me feel more intelligent than coding usually does.
By using recursion, a function is able to define an infinite amount of objects within a finite line of code. The ability to call upon oneself gives a function the power that it itself creates, and I find that pretty amazing. Coding can get extremely complex, but every coder out there is working on simplifying the process and making everything more user-friendly.
There are several languages that rely solely on recursion, and they are considered just as powerful as other languages. They by-pass while loops and if statements and get straight to the point while maintaining the ability to perform the required tasks.
Compared to iterative programming, recursion is at par. They both have strengths and weaknesses, but both can solve similar problems. Going between the two is quite simple, either by adding a tail recursion or a recursive stack.
In summary; I've enjoyed recursion in class these past few weeks. It has made using the Tree methods easier and made the writing of the code faster. I enjoy thinking up more efficient ways to produce an output and can relate this to solving a logic puzzle. I plan on using recursion for my next assignment, as well as in class and labs.
No comments:
Post a Comment