Sunday, 7 February 2016

Week 4 Linked Lists Ahoy and Finishing Stacks/Containers

This week we reviewed the topic of container classes like the stack before diving into a very popular interview data structure, the Linked List. Though we knew how to make nested lists, making an entirely new class whose sole purpose was to imitate nested lists more effectively/efficiently was intriguing.

Stacks

I'm guessing the whole idea of a stack is to get us acquainted with thinking of programming problems as object based as possible. This week's parenthesis example was perfectly suited to the idea of a 'stack'; due to the scaling aspect of the stack as well as the intuitive nature of the solution. Because functionally speaking, you could do pretty much the same things you could do with a stack with a simple list. The usefulness will probably increase drastically for more complicated programs that require some kind of Last in first out storage system - a stack / sack class will certainly reduce the headaches of rewriting code over and over again. 

Linked Lists

The professor went into some detail about why Linked Lists have certain advantages over regular lists using interactive activities. I truly appreciated a hands on teaching method as Linked Lists are quite abstract not to mention completely new concepts even for former 108 students.

Since we only briefly touched on Linked Lists, I scrounged for learning materials online and I found this video particularly helpful in supplementing the lecture material and website material:


Even though it's in C++, one could abstract from it the general idea behind nodes/linked lists very easily.

Another video I found particularly helpful is this one by Joe James from youtube. This video is specific to Python:
Another aspect of this week's material I found interesting was the usage of recursion to facilitate linked list searching. Recursion seems to solve certain problems more easily than using tons of loops; the problem for me is that figuring out the incremental algorithm that will collapse the problem to the base case has always been difficult to figure out.

I hope we get enough guidance so that we can be as fluent with recursive solutions as we already are with the loop variants.

No comments:

Post a Comment