Sunday, February 2, 2014

SLOG-Week Four

In week 4, I learned about recursion. I was impressed by the magic of recursion for solving a difficult problem in just few steps. In class, we were introduced two  examples of recursion, which are counting the depth of a list, and drawing turtles on the screen. The code showed by professor is extremely short, with most of it being just a single line. However, I find it very difficult to comprehend the concept without being able to know the mechanics that makes it work. With such an difficulty, I have a lot of trouble understanding how the recursive code actually works. So in order to help me get a better understanding, I have used the visualizer and a pen to help me to trace down every single step of the recursion code. Although this process is frustrating, it allow me to gain a better understanding with the recursion codes. After I went through all  the process, I can now write recursive code more efficiently, especially the code in A1 step 5.

1 comment: