AlgoScope

Delete Node

Route the predecessor's pointer around the node, then drop it.

Linked list algorithms, algorithm, beginner
Node 5 does not match 4. Moving on.5142currhead5 > 4
Node 5 does not match 4. Moving on.5142currhead5 > 4

Singly Linked List: Delete 4

Decision, step 2 of 9

5 is not 4: keep walking.

How singly linked list works

Cost

Best
O(1)
Average
O(n)
Worst
O(n)
Space
O(1)

Leads to

Topics that need this one first.

Taught by the same lesson

Singly Linked List covers these too, in the same run.