suffix-array-0.3.0.0: Simple and moderately efficient suffix array implementation

CopyrightJoshua Simmons 2017
LicenseBSD3
Maintainerjoshua.simmons@emptypath.com
Safe HaskellNone
LanguageHaskell2010

Data.SuffixArray

Description

Suffix array library main module

Synopsis

Documentation

data SuffixArray a Source #

Holds the computed suffix array data

Constructors

SuffixArray 

Fields

suffixArray :: Ord a => [[a]] -> SuffixArray a Source #

Compute the suffix array of the given string(s) concatenated together with Sentinals after each.

worst case O(n lg n) time (where n is the sum of the string lengths + the number of strings)

suffixArrayOne :: Ord a => [a] -> SuffixArray a Source #

Convenience function to compute the suffix array of a single string. (Still gets a Sentinal at the end)

worst case O(n lg n) time (where n is the length of the string)

data Alpha a Source #

A character in a string (or set of strings) we're going to compute the suffix array of. Includes Sentinal markers for the end of strings.

Constructors

Sentinal Int

Used to mark the end of a string. The Int parameter is used to encode which string this is the end of, in cases where there are multiple.

Alpha a

An actual character in the string.

Instances

Eq a => Eq (Alpha a) Source # 

Methods

(==) :: Alpha a -> Alpha a -> Bool #

(/=) :: Alpha a -> Alpha a -> Bool #

Ord a => Ord (Alpha a) Source # 

Methods

compare :: Alpha a -> Alpha a -> Ordering #

(<) :: Alpha a -> Alpha a -> Bool #

(<=) :: Alpha a -> Alpha a -> Bool #

(>) :: Alpha a -> Alpha a -> Bool #

(>=) :: Alpha a -> Alpha a -> Bool #

max :: Alpha a -> Alpha a -> Alpha a #

min :: Alpha a -> Alpha a -> Alpha a #

Show a => Show (Alpha a) Source # 

Methods

showsPrec :: Int -> Alpha a -> ShowS #

show :: Alpha a -> String #

showList :: [Alpha a] -> ShowS #

justAlphas :: SuffixArray a -> [Alpha a] Source #

Convenience function to just give a list characters in the concatenated original strings.

justLcp :: SuffixArray a -> [Int] Source #

Convenience function to just give a list of the longest common prefix of every suffix with the previous suffix in lexicographic order.

justSuffixes :: SuffixArray a -> [Int] Source #

Convenience function to just give a list of the suffixes in lexicographic order.