This week marked the introduction of linked lists, a concept which I initially imagined to be a complex archetype, however after gaining much insight it seems a much less simpler concept to apprehend.
From my understanding a linked list is quintessentially a sequence of nodes which contain values that point to another sequence or nodes. If it is not pointing to anything the value itself must be pointing to none. Danny expressed this in the lecture as classes which contained a items and values attributing to another item or value or node. A linked list is compromised of nodes as an attribute whilst referencing another node. I find the representation of linked list as a makes it the most clear. Another way of looking at it is like cargo, in a factory where each package is pointing to another package.
We covered some new methods as __len__, __contains__, __repr__, and __getitem__which I found was fairly straightforward except at first it was unclear to me what the difference between the __repr__ and __str__ method were, however after viewing some videos on youtube, it seems that __repr__ is a more formal representation of the object that can be accessed.
I found this week to be much more laid back in comparison with the previous however, the challenge was more reflected towards the understanding as opposed to application. Overall I look forward to going much more in depth with linked lists.
没有评论:
发表评论