CSC 148 SLOG for Week 5
This week we learned
about the concepts and possible algorithms behind the assignment, however it
doesn't really help me since I already finished it last week. The explanation
on the Tour of Anne Hoy method was pretty helpful though, since I didn't fully
understand the meaning of it when I used it, but now it seems much clearer to
me. We learned about recursive data structures in the second lecture and this
is something completely new to me. I find it quite rare to learn something that
is not a built-in class or function, which was also the case when I learned
computer science in high school. Recursive data structures appear to me similar
to searching and sorting algorithms, which are important fields but are
algorithms and conventions instead of existing classes and functions. This
week's lab was essentially all about recursion, which I feel pretty confident
about since I used it many times before I started this class because it is just
too convenient and too useful, if you can get the idea right. I feel like
recursion requires a lot of thinking but very little writing, which is also
what I felt when I did the assignment. However, I had a question about how to
solve the issue of initializing a variable and returning it at the end using a
recursive method since the variable would be reinitiated every recursion. Then
with the help of my TA I realized that if I use a for loop with in a recursive
method I could avoid this problem since the variable would be returned and the
variable with the same name of the previous iteration is indeed another
variable and there wouldn't be a conflict, which is something new that I
learned.
Very good and thought out descriptions. I'd be curious to see some of the recursive methods you wrote before this course and some that you've written recently.
ReplyDeleteUnfortunately I don't have any code I wrote before this course since I switched a computer after entering university. This year my favorite code so far is what I wrote for e4b which is very concise and it shows that I now understand list comprehensions and tuples which are new features of python. I don't know how to upload files here so if you can tell me I will give it to you.
Delete