Sunday, April 5, 2015

Last impressions

Over the course of this term, I learned many new things. First of all, I learned more about classes and got to know two new types of abstract data structure, namely Stack and Queue. I learned to write different methods for the classes, such as __eq__, __repr__, __str__ etc.. I found out that classes can build on a preexisting class, and adopt all of its features using inheritance. This increases efficiency because it reduces the need to write duplicate code, if one or more classes have common features with another class.
I also learned about tracing and writing functions. Recursion was very hard for me in the beginning because I tend to lose track of what the code does when it calls itself again without finishing the initial call. Luckily, I had help from my friends and Prof. Danny. They traced a couple functions with me and cleared a lot of my confusions. Writing recursive functions was also fairly challenging. I learned that to write them, I need to consider what is the simplest case that does not need recursion (which is the base case), and then ensemble these simple pieces of information together that returns a desired result.
Trees (and binary trees) are applications of recursion. Trees have a recursive nature in which one children can branch off and have many children and so on. I had a lot of practice in using recursion during tutorials and assignments, in which many tasks involve finding how many internal nodes there are, or returning particular values at the leave nodes. Linked lists are kind of like trees in which they also have nodes, but are ordered in a linear fashion. In beginning, I was confused of why there are two classes for linked lists, and what instance variables to refer to in writing code for them. But later I learned that, linked lists involve a collection of nodes. Hence, one class is specifically one node, and another class is a wrapper that stores the collection. Trees and linked lists are two new data structures that I learned in this term, which I think will be very beneficial in solving problems in the future.
Towards the end of the term, csc148 had a lot of overlaps with csc165. I learned more about algorithm's running time, worst case running time, and asymptotic representations of these running time. I learned that running time varies depending on the size of input (n) and I saw examples of code that is big-O of n, n^2, n^3 and lg(n). These notations allow us to better analyze and compare the efficiency of different codes, which is very helpful in terms of choosing the better option. If there are more options available for achieving a same task, but one has a running time in O(n^2) while another has O(lg n), then the latter one is much of efficient for users, because when input size n gets large, n^2 is huge and takes a long time, but lg n is much faster. 
This term taught me a lot of useful techniques, like tracing functions, writing recursion and many new data structures, like Stack, Tree etc. They combine to prepare me to be a more efficient problem solver. Although I had challenges along the way, csc148 was certainly useful and heuristic, as it gave me practices on logical reasoning and problem solving.

No comments:

Post a Comment