Trie_ds
layout: post title: Trie DS —
Trie DataStructure
- Trie: A datastructure that is made to search for strings swiftly.
- Trie Main Theory
- Produce words in the form of a dictionary and use the tree’s Parent & child node relationship for searching
Features of Trie
N dimension Trie : Determine N depending on the type of alphabet.
ex.
Alphabet is composed of 26 letters. Therefore this is a 26 dimension tree.
ex. The following are the figure of inputting the english words ‘apple, air, apply’.
Process
- The root node remains a vacant state.
- Produce a node that corresponds to each alphabet.
- Input the word ‘air’
- While the ‘a’ node is not in a vacant state, the node ‘i’ and ‘r’ are vacant, so it new nodes are produced.
- Input the word ‘apply’
- The similar process is repeated. If the searching node is vacant, produce new nodes.
If not, implement the data structure ‘Trie’
Implement Code Trie DS