blog/content/posts/2024-06-30-trie/index.md

1 KiB

title date draft description tags categories series favorite disable_feed
Trie 2024-06-30T11:07:49+01:00 false A cool map
algorithms
data structures
python
programming
Cool algorithms
false false

This time, let's talk about the Trie, which is a tree-based mapping structure most often used for string keys.

What does it do?

A Trie can be used to map a set of string keys to their corresponding values, without the need for a hash function. This also means you won't suffer from hash collisions, though the tree-based structure will probably translate to slower performance than a good hash table.

A Trie is especially useful to represent a dictionary of words in the case of spell correction, as it can easily be used to fuzzy match words under a given edit distance (think Levenshtein distance)