Search⌘ K

What is a Trie?

Explore the trie data structure, also known as a prefix tree, to understand its properties and how it enables fast string retrieval. Learn its common applications like autocomplete, spell-checking, and searching contacts, with a focus on its implementation in Python.

Introduction

In the previous section, we covered several common types of trees like Red-Black trees, 2-3 trees, etc.

Now, we are going to look at a tree-like data structure that proves to be really efficient while solving programming problems related to strings.

This data structure is called a trie and is also known as a Prefix Tree. We will soon find out why.

The tree trie is derived from “retrieval.” As you ...