suffix-array-rust

Crates.iosuffix-array-rust
lib.rssuffix-array-rust
version0.1.0
sourcesrc
created_at2020-04-23 20:48:18.579814
updated_at2020-04-23 20:48:18.579814
descriptionA simple library that can be used to perform suffix array operations
homepage
repositoryhttps://github.com/petar-dambovaliev/suffix-array-rust
max_upload_size
id233405
size9,547
Petar Dambovaliev (petar-dambovaliev)

documentation

README

Suffix Array

This package provides common functionality associated with suffix arrays. It uses the LCP array addition as well.

    let s = String::from("azaza");
    let sa = array::new(s.as_str());
    let subs = sa.distinct_sub();
    
    
    let s = String::from("azaza");
    let sa = array::new(s.as_str());
    assert_eq!(9, sa.distinct_sub_count());
    
    let s = String::from("azaza");
    let sa = array::new(s.as_str());
    assert_eq!(15, sa.sub_count());
    
    let s = String::from("abracadabra");
    let sa = array::new(s.as_str());
    let lrs = sa.longest_repeated_substr();

    assert_eq!(1, lrs.len());
    assert_eq!("abra", str::from_utf8(&lrs[0]).unwrap());
Commit count: 5

cargo fmt