Ordering suffix positions

Every position in a length-n text begins a suffix extending to its end. Sorting these suffixes produces an array of their starting positions, separating suffix rank from original-text offset.

In banana, suffixes beginning with a cluster together although their original positions differ. Keeping the text plus integer offsets avoids separately copying suffixes of lengths n, n−1 and so on into quadratic total storage.

References: [1] [2]

Shared prefixes form a search interval

Suffixes beginning with a pattern occupy a contiguous lexicographic interval. Ordered searches can locate that range and return its original offsets, which need not already be in text-position order.

Longest common prefixes between adjacent suffixes help expose repeated substrings. APIs can offer rank, offset selection and prefix-length queries. Returning one offset and enumerating every match have different output costs.

References: [1] [2]

Index size does not determine construction time

Storing n offsets can use linear space without making construction linear-time. Comparator sorting may repeatedly scan long common prefixes. Princeton also supplies three-way radix quicksort construction, explicitly warning about highly repetitive worst cases.

Changing the text can invalidate offsets and their order. Choosing this index over per-pattern scanning requires accounting for construction, query count, character comparisons and auxiliary information rather than only the later binary-search step.

References: [1] [2]