Trie vs Hash Table

This lesson highlights the differences between a Trie and a Hash Table, including their common applications.

Comparison between Trie & HashTable

One might wonder what is the need of using Tries when we can implement dictionaries with Hash Tables as well. A simple answer to this would be, yes, you can use Hash Tables to build dictionaries, but if you need a fast lookup and have long words which share common prefixes then a Trie is the perfect data structure for you. It also makes storing words easier, as the implementation is very simple. Some of the key points which differentiate a Hash Table from Tries are given below:

1. Common Prefixes

In ...