The link that points at itself.
transcript
You insert a node. The list looks right. Then a walk never ends. Two lines were swapped. No error. No warning.
The list is five, ten, twenty. Insert fifteen after ten. Ten has a next: twenty. That next must not be lost. Order of writes is the whole trick. Four writes will do it.
First, fifteen copies ten's next. Then twenty points back at fifteen. Then ten points at fifteen. The list is whole. Each write has one job. Now the walk ends.
Now ten points at fifteen first. Then fifteen copies ten's next. Ten's next is fifteen now. Fifteen points at itself. The rest of the list is lost.
Set the new node first. Then the neighbours. Read before you write. Update both directions. Draw it on paper first. Then check both directions.
Read before you write. New pointers first. Draw four writes. Then test the walk. Full breakdown in the lecture.