Binary search
Range of suffixes with pattern prefix forms contiguous SA range. Find lower + upper via binary search on prefix comparison.
Advertisement
Complexity
O(M log N) — each of log N comparisons costs O(M). Improved to O(M + log N) with LCP array (Manber-Myers).
Advertisement
Occurrences count
Range width in SA = occurrence count. All occurrence positions = SA[l..r].
vs Suffix tree
Suffix tree: O(M) match. SA: O(M + log N). Comparable in practice, SA more space-efficient.