Construction of Aho Corasick Automaton in Linear Time for Integer Alphabets

  • Shiri Dori
  • Gad M. Landau
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3537)


We present a new simple algorithm that constructs an Aho Corasick automaton for a set of patterns, P, of total length n, in O(n) time and space for integer alphabets. Processing a text of size m over an alphabet Σ with the automaton costs \(O(m \log \left|\Sigma\right| + k)\), where there are k occurrences of patterns in the text.


Output Function Query Processing Search Time Failure Link Linear Time Algorithm 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Abouelhoda, M.I., Kurtz, S., Ohlebusch, E.: Replacing suffix trees with enhanced suffix arrays. J. Discrete Algorithms 2(1), 53–86 (2004)zbMATHCrossRefMathSciNetGoogle Scholar
  2. 2.
    Aho, A.V., Corasick, M.J.: Efficient string matching. Comm. ACM 18(6), 333–340 (1975)zbMATHCrossRefMathSciNetGoogle Scholar
  3. 3.
    Andersson, A., Nilsson, S.: A New Efficient Radix Sort. In: Proc. 35th IEEE Symposium on Foundations of Computer Science, pp. 714–721 (1994)Google Scholar
  4. 4.
    Chen, M.T., Seiferas, J.: Efficient and Elegant Subword-Tree Construction. In: Apostolico, A., Galil, Z. (eds.) Combinatorial Algorithms on Words, pp. 97–107. Springer, Heidelberg (1985)Google Scholar
  5. 5.
    Farach, M.: Optimal suffix tree construction with large alphabets. In: Proc. 38th IEEE Symposium on Foundations of Computer Science, pp. 137–143 (1997)Google Scholar
  6. 6.
    Gonnet, G., Baeza-Yates, R., Sinder, T.: New Indices for text: PAT trees and PAT arrays. In: Frakes, W.B., Baeza-Yates, R. (eds.) Information Retrieval: Data Structures and Algorithms, Prentice Hall, Englewood Cliffs (1992)Google Scholar
  7. 7.
    Gusfield, D.: Algorithms on strings, trees, and sequences. Cambridge University Press, Cambridge (1997)zbMATHCrossRefGoogle Scholar
  8. 8.
    Kärkkäinen, J., Sanders, P.: Simple linear work suffix array construction. In: Baeten, J.C.M., Lenstra, J.K., Parrow, J., Woeginger, G.J. (eds.) ICALP 2003. LNCS, vol. 2719, pp. 943–955. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  9. 9.
    Kim, D.K., Jeon, J.E., Park, H.: Efficient Index Data Structure with the Capabilities of Suffix Trees and Suffix Arrays for Alphabets of Non-negligble Size. In: Apostolico, A., Melucci, M. (eds.) SPIRE 2004. LNCS, vol. 3246, pp. 138–149. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  10. 10.
    Kim, D.K., Sim, J.S., Park, H., Park, K.: Linear-time construction of suffix arrays. In: Baeza-Yates, R., Chávez, E., Crochemore, M. (eds.) CPM 2003. LNCS, vol. 2676, pp. 186–199. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  11. 11.
    Knuth, D.E., Morris Jr., J.H., Pratt, V.R.: Fast pattern matching in strings. SIAM J. Comput. 6, 323–350 (1977)zbMATHCrossRefMathSciNetGoogle Scholar
  12. 12.
    Ko, P., Aluru, S.: Space-efficient linear-time construction of suffix arrays. In: Baeza-Yates, R., Chávez, E., Crochemore, M. (eds.) CPM 2003. LNCS, vol. 2676, pp. 200–210. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  13. 13.
    Manber, U., Myers, G.: Suffix arrays: A new method for on-line string searches. SIAM J. Comput. 22(5), 935–948 (1993)zbMATHCrossRefMathSciNetGoogle Scholar
  14. 14.
    McCreight, E.M.: A space-economical suffix tree construction algorithm. J. of the ACM 23(2), 262–272 (1976)zbMATHCrossRefMathSciNetGoogle Scholar
  15. 15.
    Paige, R., Tarjan, R.E.: Three Partition Refinement Algorithms. SIAM J. Comput. 16(6), 973–989 (1987)zbMATHCrossRefMathSciNetGoogle Scholar
  16. 16.
    Ukkonen, E.: On-line construction of suffix trees. Algorithmica 14, 249–260 (1995)zbMATHCrossRefMathSciNetGoogle Scholar
  17. 17.
    Weiner, P.: Linear pattern matching algorithm. In: Proc. 14 IEEE Symposium on Switching and Automata Theory, pp. 1–11 (1973)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2005

Authors and Affiliations

  • Shiri Dori
    • 1
  • Gad M. Landau
    • 1
    • 2
  1. 1.Department of Computer ScienceUniversity of HaifaHaifaIsrael
  2. 2.Department of Computer and Information SciencePolytechnic University, Six MetroTech CenterBrooklynUSA

Personalised recommendations