A linked list is a particular recursive data structure made up of nodes where each node contains some data and a reference to the next node in the linked list.
We can distinguish the head from the rest in a linked list. The head is the first element in this structure and the rest is simply the remaining elements of it.
This is what a linked list looks like:
There’s two important things that we should consider when dealing with linked lists:
-The reason why separating the head from the rest is so useful is because the head has a reference to the first node in the rest. So the head is indirectly connected to every element in the list. We can define methods that traverse the full length of the linked list by calling them on the head.
-When we create a new node, if we don’t define its next value, this will be set to None by default. So the last element in every linked list has always a reference to None.
This week, we have also learned that, in order to define methods in a given class, we can use wrapper methods that will inherit helper methods from another class during their implementation.
For example, we have seen how we can create two separate classes for nodes and linked lists. This will allow us to implement the insert method for linked lists (inserting new nodes at the head of the linked list) by using the references that nodes have to next nodes (defined in the node class). We would have to say that the new node has a reference to the current head of the linked list.
We can also use this approach in binary search trees. In this case, we would define an insert method in the node class to determine where should a new node be created according to a specific data (left or right?) depending on the data of another node. When we inherit this method in the binary search tree class it will automatically place new nodes in their corresponding location.

