General Notes

Linked List

  • Nodes: Basic data structure which contains data and one or more links/pointers to other nodes. Nodes can be used to represent a tree structure or a linked list.
    • Node’s successor is the next node
    • Node's predecessor is the previous node
  • Pointers: Variable that stores the memory address of another variable as its value
  • A linked list is a data structure used to store a collection of items where each item is linked to the next one using pointers.
  • Traverse a linked list: Start at the first node and then go from node to node, following each node’s pointer to find the next node.
  • Two types depending on how data is sorted: ordered and unordered.
  • Linked List can be implemented using 2D Arrays (Singly)
  • The arrays are for data and the other for pointers
  • Uses:
    • Image viewer, Pages in Web browser, Music/Video Player, GPS, Task Scheduling, Symbol Table in Compilers, Undo and Redo
  • Advantage: Fast insertion and deletion
  • Disadvantage: Slow Search

Code for Linked List

PYTHON

Python can be executed directly in the browser.

Editor — Python
Output
No output yet.