Singly Linked List
Each node points at the next. To reach the tenth you walk the first nine.
Decision · step 2 of 11Singly Linked List: Reverse the list
Remember next (1), then flip 5's arrow to point back at null.
What you will see
VALUE | NEXT boxes joined by arrows; insertion is a pointer detaching and reattaching, never a shift.
Cost
| access | O(n) |
|---|---|
| search | O(n) |
| insert at head | O(1) |
| insert after node | O(1) |
| delete after node | O(1) |
| insert at tail | O(n) |
| Space | O(n) |
Insert at tail is O(1) with a tail pointer.
How you work with it here
play it through, step one change at a time, scrub to any step, run it on your own input, try operations in any order.
Screen readers: Each element is an accessibility element with position, value and state; structural changes are announced per step.
Reduced motion: Elements appear at their destination with a crossfade; no travel longer than the element's own size.
Before this
Leads to
Topics that need this one first.
Taught by the same lesson
Singly Linked List covers these too, in the same run.