mirror of
https://github.com/dholerobin/Lecture_Notes.git
synced 2025-07-01 13:06:29 +00:00
Update Trie.md
This commit is contained in:
parent
f7bea0e794
commit
f6387c0b5a
@ -19,9 +19,11 @@ Trie is a very useful and special kind of data structure for string processing.
|
|||||||
Trie is a tree of nodes, where the specifications of a node can be given as below:
|
Trie is a tree of nodes, where the specifications of a node can be given as below:
|
||||||
|
|
||||||
Each node has,
|
Each node has,
|
||||||
1. An array of datatype `node` having the size of the alphabet(see the note below).
|
1. An array of size of the alphabet(see the note below).
|
||||||
2. A boolean variable.
|
2. A boolean variable.
|
||||||
|
|
||||||
|
**Note:** For an easy understanding purpose, we are assuming that all strings contain lowercase alphabet letters, i.e. `alphabet_size` is $26$. **We can convert characters to a number by using `c-'a'`, `c` is a lowercase character.**
|
||||||
|
|
||||||
**We will see usages of these two variables soon.**
|
**We will see usages of these two variables soon.**
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
@ -41,8 +43,6 @@ struct trie_node
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note:** For an easy understanding purpose, we are assuming that all strings contain lowercase alphabet letters, i.e. `alphabet_size` is $26$. **We can convert characters to a number by using `c-'a'`, `c` is a lowercase character.**
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Now, we have seen how a trie node looks like. Let's see how we are going to store strings in a trie using this kind of node.
|
Now, we have seen how a trie node looks like. Let's see how we are going to store strings in a trie using this kind of node.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user