This week, I have gained deeper understanding of ADTs by learning the stack example. I have also become more familiar with implementing a class as well as testing using unittests. I find that there are multiple ways of implementing a class and different approach would result in different run time. The recursion example really helped me understood how recursion is used, since I only had a very vague idea about recursion in the past few weeks. I think recursion is functioning similar as a loop, however, it works quite differently from for-loops and while-loops. while for-loops are executing the function on every element of the domain, and while-loops runs only when the given constraints are satisfied, the recursive functions recuse within the body of the argument.
No comments:
Post a Comment