Abstract
This chapter deals with topics related to string processing. Section 14.1 presents the trie structure which maintains a set of strings. After this, dynamic programming algorithms for determining longest common subsequences and edit distances are discussed. Section 14.2 discusses the string hashing technique which is a general tool for creating efficient string algorithms. The idea is to compare hash values of strings instead of their characters, which allows us to compare strings in constant time. Section 14.3 introduces the Z-algorithm which determines for each string position the longest substring which is also a prefix of the string. The Z-algorithm is an alternative for many string problems that can also be solved using hashing. Section 14.4 discusses the suffix array structure, which can be used to solve some more advanced string problems.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
Gusfield [13] presents the Z-algorithm as the simplest known method for linear-time pattern matching and attributes the original idea to Main and Lorentz [22].
- 2.
The idea of prefix doubling is due to Karp, Miller, and Rosenberg [17]. There are also more advanced O(n) time algorithms for constructing suffix arrays; Kärkkäinen and Sanders [16] provide a quite simple such algorithm.
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
Copyright information
© 2017 Springer International Publishing AG
About this chapter
Cite this chapter
Laaksonen, A. (2017). String Algorithms. In: Guide to Competitive Programming. Undergraduate Topics in Computer Science. Springer, Cham. https://doi.org/10.1007/978-3-319-72547-5_14
Download citation
DOI: https://doi.org/10.1007/978-3-319-72547-5_14
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-72546-8
Online ISBN: 978-3-319-72547-5
eBook Packages: Computer ScienceComputer Science (R0)