Linked Lists

Singly linked list operations with one-way next pointers

Linked Lists: Singly Linked List

Node Chain
Pick a singly linked list operation to animate the node links.

Singly Linked List Operations

Insert Head changes the head pointer in constant time because the new node only needs to point to the old head.

Insert Tail and Delete rely on finding the right predecessor in a singly linked chain.

Traverse walks node by node using only the `next` pointer until reaching `null`.

Complexity

Insert Head
Time:O(1)
Space:O(1)
Insert Tail
Time:O(n)
Space:O(1)
Delete
Time:O(n)
Space:O(1)
Traverse
Time:O(n)
Space:O(1)