This week in class we learned how to trace recursion. At first I thought it would be really complicated because I found it troubling to write recursive code in High school. But, after tracing code a couple times it turned out to be pretty easy. The thing that really helped was drawing a diagram and writing out the code that it goes through step by step.
Tracing the code during the lab was pretty simple too. Writing out all the steps on paper really helped too. Also I plugged in values of recursive calls that I have already solved.
The class also learned how do trace recursive functions involving the Tree ADT. At first I thought it would be really complicated because I didn't really know what Trees were, but after thinking about it a bit more I was a lot easier to understand. It turned out it wasn't as complicated as I thought it was. The main thing that really helped was drawing the Tree out, then actually tracing it.
No comments:
Post a Comment