Académique Documents
Professionnel Documents
Culture Documents
Representation Of Trie
The trie have two category of node structures.
Branch node Information node
A branch node is merely a collection of LINK fields each pointing either to a branch node or to an information node. An information node holds the keys that is to be stored in the trie.
Operations In Trie
The three operations in the trie data Structure are
Searching a trie
Insertion
Deletion
Example
Construct a Trie for the keys 001,100,111,011,010 STEP 1: Insert (001,100) 0 1
001
100
Example
STEP 2: Insert(111) 0 1
0
001
100
111
Example
STEP 3: Insert(011)
001
011
100
111
Example
STEP 4: Insert(010)
0 0 1 0
1 1
001
100
111
010
011
INSERTION
To Insert a key K into the trie we begin as we would to search for the key k, possibly moving
Insertion
In the Above constructed trie INSERT A KEY 101. 0 1
001
111
010
011
100
101
Deletion
The deletion of a key K from a trie proceeds as one would to search for the key. On reaching the information node(node l)holding k, the same is deleted. It need to be ensured the branch node to which node l is linked accommodates other information node as well! If there is more than1 information node/if there is at least one LINK field/or both ,then deletion id done. If it leaves the branch node with just one more key ,we delete the branch node and push the node to a higher level If the situation leads to node being the only non empty node , once again we delete the branch node and push node to a higher level.
Deletion
Delete 010: 0 1
001
111
010
011
100
101
Performance Of trie
The performance of search trees is determined by the number of keys that form the tree.
search tree.
In contrast, the performance of the trie is dependent on the length of the key-The number of characters forming
target word.
Starting from the root node, you can check if a word exists in the trie easily by following pointers
AUTO COMPLETE
Auto-complete functionality is used widely over the internet and mobile apps. A lot of websites
CRIMINOLOGY
Suppose that you are at the scene of a crime and observe the first few characters CRX on the
192.168.0.0/16
When the address 192.168.20.19 needs to be looked up, both entries in the routing table "match". That is, both entries contain the looked up address. In this case, the longest prefix of the candidate routes is 192.168.20.16/28, since its subnet mask (/28) is higher than the other entry's mask (/16), making the route more specific.
A network browser keeps a history of the URLs of sites that you have visited. By organizing this history
SPELL CHECKERS
Spell checkers are ubiquitous. Word processors have spell checkers, as do browser-based e-mail clients.
SPELL CHECKERS
There are many appropriate data structures to store the word list, including a sorted array
Spell Check..
Spell Check..
a bc
0 p
0
a e i u pug pig
1
a page g s
peg
pest
Example
a bc r s z
Contacts in Phone book t alberto ram sankar star stella
0
a alberto ram
1
a e
sanka r
2
star
stella
TRIES IN T9
T9 is a technology used on many mobile phones to
make typing text messages easier. The idea is simple - each number of the phone's keypad corresponds to 3-4 letters of the alphabet. Many phones will notice when you type in a word that is
not in its dictionary, and will add that word. Others keep
track of the frequency of certain words and favor those words over other words that have the same sequence of
keypresses.
TRIES IN T9
How does a T9 dictionary work?
It can be implemented in several ways, one of
TRIES IN T9
It can be implemented using nested hash tables
as well, the key of the hash table is a letter and on every digit the algorithm calculates all possible routes (O(3^n) routes). For example, If we type '4663' we get 'good' when we press down button we get 'gone' then 'home' etc..