Where fast should start
transcript
A merge sort needs a chain cut in half. Two pointers can find the middle for you. But one wrong start position breaks it. Let us see which start is the right one.
Take six nodes. Slow starts on ten, and fast starts on twenty. Each round, slow moves one node and fast moves two. Slow reaches thirty, and fast reaches sixty, the last node. Cut the chain right after thirty.
Start both on the head. Slow ends on the last node. Now the right half is empty, and the sort never ends. Start fast one node ahead, and each half gets one node.
Test a chain of one node first. Then test a chain of two nodes. This is the case that fails. Then test three nodes, where the halves differ in size.
Sorting a hundred thousand entries took about 1.5 million compares. Comparing every pair would take almost five billion.
Start fast one node ahead of slow. Always test the chain of two nodes. Full breakdown in the lecture.