Suffix Arrays: A New Method for String Searches

suffix arrays a new method for on line string n.w
1 / 21
Embed
Share

Introducing a new data structure called a suffix array for efficient on-line string searches. Suffix arrays offer advantages over suffix trees in terms of space efficiency and competitive time complexity. This paper presents novel algorithms for constructing and querying suffix arrays, making them a practical and effective tool for various applications. Explore the concept of suffix arrays as a superior alternative to suffix trees in many scenarios.

  • Suffix Arrays
  • String Searches
  • Data Structure
  • Algorithms

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. SUFFIX ARRAYS: A NEW METHOD FOR ON-LINE STRING SEARCHES Udi Manber, Gene Myers SIAM J. COMPUT. Vol. 22, No. 5, pp. 935-948, October 1993 Presenter: Yi-Sheng Chen Date: Feb. 25, 2025

  2. Abstract(1/2) A new and conceptually simple data structure, called a suffix array, for on-line string searches is introduced in this paper. Constructing and querying suffix arrays is reduced to a sort and search paradigm that employs novel algorithms. The main advantage of suffix arrays over suffix trees is that, in practice, they use three to five times less space. From a complexity standpoint, suffix arrays permit on-line string searches of the type, "Is W a substring of A?" to be answered in time O(P + log N), where P is the length of W and N is the length of A, which is competitive with (and in some cases slightly better than) suffix trees.

  3. Abstract (2/2) The only drawback is that in those instances where the underlying alphabet is finite and small, suffix trees can be constructed in O (N) time in the worst case, versus O (N log N) time for suffix arrays. However, an augmented algorithm is given that, regardless of the alphabet size, constructs suffix arrays in O (N) expected time, albeit with lesser space efficiency. It is believed that suffix arrays will prove to be better in practice than suffix trees for many applications.

  4. Suffix Array S= banana$ , Suffix Array = 7 6 4 2 1 5 3 S7 $ S1 banana$ S6 a$ S2 anana$ lexicographical order S4 ana$ S3 nana$ S2 anana$ S4 ana$ S1 banana$ S5 na$ S5 na$ S6 a$ S3 nana$ S7 $

  5. Longest Common Prefix S= banana$ , Suffix Array = LCP = 0 1 7 6 4 2 1 5 3 3 0 0 2 Common Prefix SA[i] substring SA[i-1] substring LCP(SA[i], SA[i-1]) 7 $ 6 a$ 7 $ 0 4 ana$ 6 a$ a 1 2 anana$ 4 ana$ ana 3 1 banana$ 2 anana$ 0 5 na$ 1 banana$ 0 3 nana$ 5 na$ na 2

  6. Binary search W in A with lcp Initial : S7 $ l = lcp (SArray[0], W) =0 S6 a$ If W= ana , A= banana$ r = lcp (Sarray[N-1], W) =2 S4 ana$ L=0, R=6, M=3 S2 anana$ S1 banana$ Iterate 0 1 2 3 S5 na$ l 0 0 1 1 S3 nana$ r 0 3 3 3 L 0 0 1 1 Lw R 6 3 3 2 M 3 1 2

  7. S7 $ S6 a$ W= ana S4 ana$ S2 anana$ 0 1 2 3 4 5 6 S1 banana$ 7 6 4 2 1 5 3 S5 na$ S3 nana$ L M R Iterate 0 1 2 3 l 0 r 0 m 3

  8. S7 $ S6 a$ W= ana S4 ana$ S2 anana$ 0 1 2 3 S1 banana$ 7 6 4 2 S5 na$ S3 nana$ R L M Iterate 0 1 2 3 l 0 0 r 0 3 m 3 1

  9. S7 $ S6 a$ W= ana S4 ana$ 1 2 3 S2 anana$ 6 4 2 S1 banana$ S5 na$ L M R S3 nana$ Iterate 0 1 2 3 l 0 0 1 r 0 3 3 L_W = R = 2 m 3 1 3

  10. Algorithm(Lw)

  11. Improvement Time complexity: O(PlogN) (only binary search) O(P+logN) (with the lcp information) since each comparison either halves the searching range, or consumes one letter in W.

  12. H-buckets An H-Bucket store the set of suffixes, where the lcp value of these suffixes is at least H. The sorting is accomplished by constructing 1-buckets, 2-buckets, 4- buckets, , 2logn-buckets. (This takes O(logN) stages)

  13. H-buckets 1-buckets S0 S1 banana banana$ n a b $ 7 2, 4, 6 1 3, 5 S1 S2 anana anana$ S3 nana$ S2 nana S4 ana$ S3 S5 ana na$ S4 S6 na a$ S5 S7 a $

  14. 1-buckets a n b $ 7 2, 4, 6 1 3, 5 2-buckets an na a n ba b a 6 1 3, 5 an ba na n a b a 6 2 1 3, 5 6 ba n a an ba na a 6 1 6 2, 4 1 3, 5 4, 8, 2logn-buckets na a ba 6 1 3 7 6 4 2 1 5 3

  15. Time complexity Total O(logN) stages and each takes O(N) time to complete Time complexity O(NlogN)

  16. Lcp Suffix Array S7 $ 7 6 4 2 1 5 3 S6 a$ S4 ana$ S2 anana$ Lcp S1 banana$ (computed during the sorting) S5 na$ - 0 1 3 0 0 2 S3 nana$

  17. Computing lcp a b n $ 1-buckets $ 1, 3, 5 0 2, 4 - 0 0 0 na a ba an 2-buckets $ 5 1, 3 0 2, 4 - 0 1 0 0

  18. Non-adjacent lcp Suffix Array S7 $ 7 6 4 2 1 5 3 S6 a$ Lcp S4 ana$ (computed during the sorting) S2 anana$ S1 banana$ - 0 1 3 0 0 2 S5 na$ lcp(S6, S2) = 1, min{1, 3} = 1 S3 nana$ lcp(S4, S3) = 1, min{3, 0, 0, 2} = 0

  19. Interval Tree lcp(S6, S2) = 1, min{1, 3} = 1 0 Constructed:O(N) Find the smallest element in given interval :O(logN). 0 0 1 0 0 1 3 0 0 2

  20. Conclusion

  21. Thanks

Related


More Related Content