# Trie

> A tree that stores words letter by letter. Shared starts share a branch.

**Field:** Software Development  
**Category:** Algorithms & Data Structures  
**Also known as:** Prefix Tree, Digital Tree

## Think of it like

Think of it like a word tree. Words that start the same share the same branch.

## Definition

A trie is a tree that stores words one letter per step. Words that begin with the same letters share the same path from the root. To find every word that starts with "ca", you walk down c, then a, and read everything below. The time to find a word depends on its length, not on how many words are stored. Search boxes use tries to suggest words as you type.

## Example

Lucy types "ca" into a search box. A trie of 100,000 words hands back cat, cake and car at once.

## Why it matters

Search boxes that guess the next word, and spell checkers, are built on it.

## Common mistake

Using a trie for a small word list. A sorted list or a set is simpler and fast enough.

## Three principles

- **One letter per step.** Down from the root.
- **Shared starts.** Share one branch.
- **Speed by length.** Not by word count.

## Related terms

- [Tree (Data Structure)](https://learn.benibix.com/term/development/tree)
- [Hash Table](https://learn.benibix.com/term/development/hash-table)
- [Data Structure](https://learn.benibix.com/term/development/data-structure)
- [String](https://learn.benibix.com/term/development/string)

---

Source: https://learn.benibix.com/term/development/trie
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
