less than 1 minute read


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

  1. The root node remains a vacant state.
  2. Produce a node that corresponds to each alphabet.
  3. Input the word ‘air’
  4. While the ‘a’ node is not in a vacant state, the node ‘i’ and ‘r’ are vacant, so it new nodes are produced.
  5. Input the word ‘apply’
  6. 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

Updated: