Trie is an ordered tree data structure which stores words in it so that users can search a word or a prefix quickly. Time complexity for adding a word to a Trie is $O(l)$, and for searching a word or a prefix is $O(l)$ too ($l$ is the length of the word or the prefix being added or searched). So it’s why we prefer Trie rather than Set and Hash Table in some situations, such as Dynamic Set, Associative Array and a predictive text or autocomplete Dictionary.

Read More
  • page 1 of 1
Author's picture

Haiyang Shi

A Ph.D. candidate in Computer Science and Engineering at The Ohio State University (OSU).

Graduate Research Assistant

Columbus, OH