Merge sorted lists
Combine two ascending linked lists by repeatedly taking the smaller current head.
Remember: Take the smaller head.
Example: 1 → 3 and 2 → 4 become 1 → 2 → 3 → 4.
Time: O(n + m). Auxiliary space: O(1).
Formula: take the smaller current head
Both lists must be ascending. Stable ties come from list A first. O(n + m) time; O(1) pointer workspace, excluding output/visualization.
Complexities describe the underlying algorithm; tutorial snapshots and rendering can use additional resources.
The interactive workspace loads here when JavaScript is available. You can still browse the learning notes and links above without it.