Skip to content
DSA Visualizerpreview

Insert into a sorted linked list

Walk to the last smaller node, then relink two pointers. No values move.

O(n) time · O(1) space

List3, 8, 12, 20value 10

Insert 10 into the sorted list.

List: 3 → 8 → 12 → 20 → null.
  • compare
  • swap or write
  • settled

1 / 5

Speed

Space play · ← → step · Home End jump · drag the strip to scrub