The past week, we've been working on abstract data types, specifically learning about Linked Lists, after our foray into Stacks and Queues (data types which I discovered are very prominent in every programming language). I've been able to grasp the concept of a Linked List quite well - doing the lab quite rapidly and without much trouble (passed all the doctests and tried a bunch of fringe cases), but the most interesting thing about a Linked List is the idea that it saves memory.
In what way do Linked Lists actually save us memory? We were told in class that it's due to the simplicity of the data structure and how each separate Node keeps track of simply 2 things - a value and a pointer to the next Node. However, what is it about lists that make it a less efficient (from a memory standpoint) data structure. How about hash tables? I believe that I'll do a bit of extra reading to satisfy my curiosity on this subject.
Meanwhile, I've sated some curiosity on the topic of efficiency when it comes to sorting algorithms. I was curious as to the algorithm by which Python's list.sort() method works, so I searched it up. It's called Timsort, after a guy named Tim (!), and the algorithm seems quite complicated - so I haven't delved very deeply into trying to understand it. However, I have gotten used to the more basic algorithms with sorting - bubble sort, selection sort, insertion sort, merge sort, quicksort, and heap sort - so it'll just be a matter of time until I finally try to understand how Timsort works.
No comments:
Post a Comment