reading-notes

Linked Lists

The LinkedList class is a collection which can contain many objects of the same type. The LinkedList stores its items in “containers.” The list has a link to the first container and each container has a link to the next container in the list. To add an element to the list, the element is placed into a new container and that container is linked to one of the other containers in the list.

A Linked List is a sequence of Nodes that are connected/linked to each other. The most defining feature of a Linked List is that each Node references the next Node in the link.

Linked Lists types:

  1. Singly (refers to the number of references the node has. A Singly linked list means that there is only one reference, and the reference points to the Next node in a linked list).
  2. Doubly (refers to there being two (double) references within the node. A Doubly linked list means that there is a reference to both the Next and Previous node).

Array List vs Linked List: