Lec-20,21 Tries Data Structure
Lec-20,21 Tries Data Structure
Visit: tshahab.blogspot.com
Tries
Trie is a special structure to represent
sets of character strings.
Can also be used to represent data types
that are objects of any type e.g. strings of
integers.
The word “trie” is derived from the
middle letters of the word “retrieval”.
Tries: Example
One way to implement a spelling checker is
Read a text file.
Break it into words( character strings
separated by blanks and new lines).
Find those words not in a standard
dictionary of words.
Words in the text but not in the dictionary
are printed out as possible misspellings.
Tries: Example
It can be implemented by a set having
operations of :
INSERT
DELETE
MAKENULL
PRINT
A Trie structure supports these set operations
when the element of the set are words.