Sunday, 9 March 2014

Week 8

This week, Mr. Heap talked more about linked lists. Linked lists were mentioned in high school but like many other concepts of code, I never truly understood them until I came to university. The way I see it, linked lists are lists with only two elements where the first element is an object and the second element is either empty or another linked list. There's recursion in this; the nested linked lists can be accessed with recursive concepts. The lab this week gave me some much-needed hands on practice with linked lists; implementing methods like __len__ and __setitem__ gave me some useful insight on how a linked list's structure, its strengths and its flaws.

One of the things I like about linked lists is that it is a coding concept like recursion. Linked lists are not limited to just Python; they can be implemented in other programming languages as well. Some languages like Java are very rigid when it comes to list-like variable types. For example, a Java array (Java's equivalent to Python's list) must have its maximum length be permanently set upon initialization. This can cause problems with processing efficiency but linked lists can help Java programmers around this problem.

Linked lists mirror recursion, however, when it comes to its flaws. Like a recursive function, a linked list class also requires a clever and thoughtful design. Failing to plan out a linked list's structure effectively can result in a heavily error-prone class. In other words, linked lists can be harder to design and work this than simple basic lists. Overall, like recursion, linked lists require more thought and planning in their design, but if designed properly, they can offer an alternative, more efficient method of storing data

No comments:

Post a Comment