Let's start by defining recursion. Recursion is a method of solving a problem in computer science, where the solution to the problem depends on the solutions of smaller instances of the same problem. The solution to said problem is solved by applying a function to each instance of the problem, the application of which will only stop when the base case is reached. Putting it to words is a little confusing, plenty of other sites probably explain the idea more concisely, but regardless, you get what I mean (right?).
Recursion is a very interesting method of solving problems, often reducing the code required to solve the problem by several magnitudes. This semester, we learned about ternary if statements and list comprehensions, which in many cases, reduced the code to only 1 line. Memory efficiency-wise it may not be the best solution, however it does save a lot of space when writing code.
(Not to mention, you can draw some pretty awesome pictures using ancient drawing turtles)
Recursion is a very interesting method of solving problems, often reducing the code required to solve the problem by several magnitudes. This semester, we learned about ternary if statements and list comprehensions, which in many cases, reduced the code to only 1 line. Memory efficiency-wise it may not be the best solution, however it does save a lot of space when writing code.
(Not to mention, you can draw some pretty awesome pictures using ancient drawing turtles)
In the last few weeks, we had to use recursion in most of our work, from labs to assignments to tests. This was all to drill in the recursive method of solving problems into our heads. I'll have to admit, it may have worked a little. Hopefully I can incorporate the recursive strategy into my code in the future and make my code a little more tidy. (And draw some wicked sweet pictures)
That'll be all for my SLOG this week. I guess the only special part of this SLOG was the length, but I guess it was special nonetheless. As always, thanks for reading.
No comments:
Post a Comment