Content-Length: 261226 | pFad | http://github.com/cp-algorithms/cp-algorithms/commit/e949b36d0c079da4d2914c37b9e3d12939930891

87 info about fast distinct-substring computation with suffix arrays/trees · cp-algorithms/cp-algorithms@e949b36 · GitHub
Skip to content

Commit e949b36

Browse files
committed
info about fast distinct-substring computation with suffix arrays/trees
1 parent 30e9e24 commit e949b36

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/string/string-hashing.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@ int count_unique_substrings(string const& s) {
185185
}
186186
```
187187
188+
Notice, that $O(n^2)$ is not the best possible time complexity for this problem.
189+
A solution with $O(n \log n)$ is described in the article about [Suffix Arrays](suffix-array.md), and it's even possible to compute it in $O(n)$ using a [Suffix Tree](./suffix-tree-ukkonen.md) or a [Suffix Automaton](./suffix-automaton.md).
190+
188191
## Improve no-collision probability
189192
190193
Quite often the above mentioned polynomial hash is good enough, and no collisions will happen during tests.

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/cp-algorithms/cp-algorithms/commit/e949b36d0c079da4d2914c37b9e3d12939930891

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy