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.

Level: intermediateTopic: Data structures algorithms

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

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.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.