Yup, a linked list!
Implementing these in Python and Haskell is nearly pointless, but here they are anyway.
Github :: Linked List
We can be grateful for 'special functions' in Python (ones that start and end with two underscores) as they allow us to easily apply built-ins to our data structures.
For example, asking for: len(our_list) will yields its length, so far as we've defined it in the class definition. The keyword 'in' will also work, as will print()!
No comments:
Post a Comment