Tries

A trie is a type of search tree commonly used to store dynamic arrays or associative arrays where keys are typically strings. It's a sorted tree data structure.

A trie looks similar to a tree, but it doesn't have the binary tree form that we're mostly familiar with; instead, it typically takes the form of an m-ary tree.

As seen in the illustration, in a trie, one only needs to traverse as long as the length of the string to find the desired result. Thus, since a trie is a tree structure for strings, it effectively has as many children as there are characters in the string, resulting in a tree with a significantly large number of child nodes, as can be seen in the diagram.

Tries are especially popular in the field of Natural Language Processing (NLP) as a data structure for string searching.

More about Trie: https://en.wikipedia.org/wiki/Trie

Last updated