AI engineering glossary · Data structures algorithms
What is trie?
Trie (also called prefix tree): A tree in which each edge represents a character and each path from the root spells a prefix, with nodes marking where words end. It supports lookups and prefix searches in time proportional to the word length, independent of how many words are stored.
Trie: an example
Storing 'car', 'card' and 'care' shares the path c-a-r, so typing 'car' in a search box quickly lists all three completions.
Related terms
More Data structures algorithms terms
- Two pointers
- Union-find
- Weighted graph
- Worst-case analysis
- A* search
- Abstract data type
- Adjacency list
- Adjacency matrix
Where you learn it
Trie is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.