List processing algorithms

  • Recall that:

    • The program uses the first (or head) variable to reference to the first node of a linked list

      Therefore:

      • Only the first node is immediately accessible by a program...

  • Processing data stored in a linked list (a.k.a. list processing) often requires:

    • visiting all elements in the linked list by traversing the chain

    Graphically: