Book contents
- Frontmatter
- Contents
- Preface
- I Exact String Matching: The Fundamental String Problem
- II Suffix Trees and Their Uses
- 5 Introduction to Suffix Trees
- 6 Linear-Time Construction of Suffix Trees
- 7 First Applications of Suffix Trees
- 8 Constant-Time Lowest Common Ancestor Retrieval
- 9 More Applications of Suffix Trees
- III Inexact Matching, Sequence Alignment, Dynamic Programming
- IV Currents, Cousins, and Cameos
- Epilogue – where next?
- Bibliography
- Glossary
- Index
9 - More Applications of Suffix Trees
from II - Suffix Trees and Their Uses
Published online by Cambridge University Press: 23 June 2010
- Frontmatter
- Contents
- Preface
- I Exact String Matching: The Fundamental String Problem
- II Suffix Trees and Their Uses
- 5 Introduction to Suffix Trees
- 6 Linear-Time Construction of Suffix Trees
- 7 First Applications of Suffix Trees
- 8 Constant-Time Lowest Common Ancestor Retrieval
- 9 More Applications of Suffix Trees
- III Inexact Matching, Sequence Alignment, Dynamic Programming
- IV Currents, Cousins, and Cameos
- Epilogue – where next?
- Bibliography
- Glossary
- Index
Summary
With the ability to solve lowest common ancestor queries in constant time, suffix trees can be used to solve many additional string problems. Many of those applications move from the domain of exact matching to the domain of inexact, or approximate, matching (matching with some errors permitted). This chapter illustrates that point with several examples.
Longest common extension: a bridge to inexact matching
The longest common extension problem is solved as a subtask in many classic string algorithms. It is at the heart of all but the last application discussed in this chapter and is central to the k-difference algorithm discussed in Section 12.2.
Longest common extension problem Two strings S1 and S2 of total length n are first specified in a preprocessing phase. Later, a long sequence of index pairs is specified. For each specified index pair (i, j), we must find the length of the longest substring of S1 starting at position i that matches a substring of S2 starting at position j. That is, we must find the length of the longest prefix of suffix i of S1 that matches a prefix of suffix j of S2 (see Figure 9.1).
Of course, any time an index pair is specified, the longest common extension can be found by direct search in time proportional to the length of the match. But the goal is to compute each extension in constant time, independent of the length of the match.
- Type
- Chapter
- Information
- Algorithms on Strings, Trees and SequencesComputer Science and Computational Biology, pp. 196 - 208Publisher: Cambridge University PressPrint publication year: 1997