diff options
| author | Paul Jungeblut <paul.jungeblut@gmail.com> | 2016-10-10 21:40:43 +0200 |
|---|---|---|
| committer | Paul Jungeblut <paul.jungeblut@gmail.com> | 2016-10-10 21:40:43 +0200 |
| commit | f1d5de7e374c215ce3da513d1dc3bb2577c1dc3e (patch) | |
| tree | 6d0d195884ba804e9b777a4610f6004e53a1de60 /string/trie.cpp | |
| parent | c245ad9089aeb8c7fc7683b6a8a20d04a74818f4 (diff) | |
Typesetting string section.
Diffstat (limited to 'string/trie.cpp')
| -rw-r--r-- | string/trie.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/string/trie.cpp b/string/trie.cpp index 5ee7a87..33889dc 100644 --- a/string/trie.cpp +++ b/string/trie.cpp @@ -1,6 +1,5 @@ -// Implementierung für Kleinbuchstaben. struct node { - node *(e)[26]; + node *(e)[26]; // Implementierung für Kleinbuchstaben. int c = 0; // Anzahl der Wörter, die an diesem node enden. node() { for(int i = 0; i < 26; i++) e[i] = NULL; } }; @@ -11,8 +10,7 @@ void insert(node *root, string &txt, int s) { // Laufzeit: O(|txt|) int idx = (int)(txt[s] - 'a'); if(root->e[idx] == NULL) root->e[idx] = new node(); insert(root->e[idx], txt, s+1); - } -} +}} int contains(node *root, string &txt, int s) { // Laufzeit: O(|txt|) if(s == txt.size()) return root->c; |
