Say what is settled
transcript
Pointer problems feel slippery under interview pressure. You move one pointer, and another one breaks. Three short sentences make them safe. Say them out loud before any code.
First, what has each pointer settled? Name the region behind it. Second, which pointer moves in each case, and why? Third, why is no unread value overwritten?
Merge the delivery two and four into the shelf. Five is the largest, so it fills the last slot. Four and three fill the next two slots. Two fills slot one. The shelf is now sorted.
From the front, the first write ruins an unread code. From the back, every write lands in a free slot.
A write pointer can also step back after a cut. Then the letters that joined are tested again. It still never passes the read pointer.
Say what each pointer has settled. Name the reason each pointer moves. Then each pointer can move on and never look back. Full breakdown in the lecture.