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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy