2020-06-22 14:26:06 +00:00
|
|
|
---
|
|
|
|
id: suffix-array
|
|
|
|
title: "Suffix Array"
|
|
|
|
author: Benjamin Qi
|
2020-06-28 02:11:09 +00:00
|
|
|
description: "Quickly Sorting Suffixes of a String (and Applications)"
|
2020-06-22 14:26:06 +00:00
|
|
|
prerequisites:
|
2020-06-22 20:51:12 +00:00
|
|
|
- Gold - Hashing
|
2020-06-26 18:00:32 +00:00
|
|
|
frequency: 1
|
2020-06-22 14:26:06 +00:00
|
|
|
---
|
|
|
|
|
2020-06-28 02:11:09 +00:00
|
|
|
import { Problem } from "../models";
|
2020-06-24 17:35:48 +00:00
|
|
|
|
2020-06-28 02:11:09 +00:00
|
|
|
export const metadata = {
|
|
|
|
problems: {
|
|
|
|
sample: [
|
|
|
|
new Problem("YS", "Suffix Array", "suffixarray", "Easy", false, [], ""),
|
|
|
|
],
|
|
|
|
lcpSam: [
|
|
|
|
new Problem("YS", "# of Substrings", "number_of_substrings", "Easy", false, [], ""),
|
|
|
|
],
|
|
|
|
lcp: [
|
2020-06-30 20:25:02 +00:00
|
|
|
new Problem("Plat", "Standing Out from the Herd", "768", "Hard", false, [], ""),
|
2020-06-28 02:11:09 +00:00
|
|
|
new Problem("CF", "Two Prefixes", "contest/1090/problem/J", "Hard", false, [], ""),
|
|
|
|
],
|
|
|
|
burSam: [
|
|
|
|
new Problem("CSES", "String Transform", "1113", "Easy", false, [], ""),
|
|
|
|
],
|
|
|
|
runSam: [
|
|
|
|
new Problem("YS", "Run Enumerate", "runenumerate", "Hard", false, [], ""),
|
|
|
|
]
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-07-02 17:48:28 +00:00
|
|
|
## Resources
|
|
|
|
|
2020-06-28 02:11:09 +00:00
|
|
|
<resources>
|
|
|
|
<resource source="CF" title="Suffix Array" url="edu/course/2/lesson/2" starred>Videos & Practice Problems</resource>
|
|
|
|
<resource source="cp-algo" title="Suffix Array - Definition & Construction" url="suffix-array.html" starred></resource>
|
2020-06-28 03:56:39 +00:00
|
|
|
<resource source="CPC" title="11 - Strings (Suffix Array)" url="11_strings"></resource>
|
2020-06-28 02:11:09 +00:00
|
|
|
</resources>
|
|
|
|
|
|
|
|
## Suffix Array
|
|
|
|
|
|
|
|
<problems-list problems={metadata.problems.sample} />
|
|
|
|
|
2020-07-02 17:48:28 +00:00
|
|
|
### Implementations
|
2020-06-28 02:11:09 +00:00
|
|
|
|
2020-07-02 17:48:28 +00:00
|
|
|
<resources>
|
|
|
|
<resource source="Benq" title="Suffix Array w/ LCP" url="https://github.com/bqi343/USACO/blob/master/Implementations/content/strings%20(14)/Light/SuffixArray%20(14.4).h">$O(N\log N)$</resource>
|
|
|
|
</resources>
|
|
|
|
|
|
|
|
(recommend that you also test against brute force for many small strings)
|
2020-06-28 02:11:09 +00:00
|
|
|
|
|
|
|
## LCP Array
|
|
|
|
|
|
|
|
<problems-list problems={metadata.problems.lcpSam} />
|
|
|
|
|
|
|
|
Quickly compute longest common prefix of two suffixes.
|
|
|
|
|
|
|
|
<problems-list problems={metadata.problems.lcp} />
|
2020-06-25 17:43:28 +00:00
|
|
|
|
|
|
|
## Inverse Burrows-Wheeler
|
|
|
|
|
2020-06-28 02:11:09 +00:00
|
|
|
<resources>
|
|
|
|
<resource source="GFG" title="Inverting Burrows-Wheeler Transform" url="inverting-burrows-wheeler-transform">could be simpler?</resource>
|
|
|
|
</resources>
|
|
|
|
|
|
|
|
CSES Guide?
|
|
|
|
|
|
|
|
<problems-list problems={metadata.problems.burSam} />
|
|
|
|
|
2020-06-25 17:43:28 +00:00
|
|
|
## Run Enumerate
|
|
|
|
|
2020-06-28 02:11:09 +00:00
|
|
|
<resources>
|
|
|
|
<resource source="cp-algo" title="Finding repetitions" url="main_lorentz.html">could be simpler?</resource>
|
|
|
|
</resources>
|
|
|
|
|
|
|
|
(describe how to do easily w/ suffix array)
|
|
|
|
|
|
|
|
<problems-list problems={metadata.problems.runSam} />
|
|
|
|
|