The neighbours that are not sorted
transcript
Count the different pieces of a long text. Take the count of all pieces first. Then subtract what suffixes share. But which suffixes do you compare?
Take the text a b a b. It has ten pieces in all. But only seven are different.
Take suffixes side by side in the text. They share nothing at all here. So nothing is subtracted, and the answer is ten. That is wrong. The truth is seven.
Sorting puts similar suffixes together. So sorted neighbours share the most. Neighbours in the text are unrelated. So always use the sorted order.
Sort all the suffixes first. Find the common prefix of each neighbour pair. Subtract their sum from all pieces. Seven pieces remain.
Test a text of all different letters. Test a text of one repeated letter. Test a repeating pattern like abab.
Order decides what is shared. Sort before you subtract anything. Test a text with many repeats. Then the count is exact. Full breakdown in the lecture.