Trie: Introduction
Let’s go over the Trie pattern, its real-world applications, and some problems we can solve with it.
We'll cover the following
Overview
Trie is a tree data structure used for storing and locating keys from a set. The keys are usually strings that are stored character by character—each node of a trie corresponds to a single character rather than the entire key.
The order of characters in a string is represented by edges between the adjacent nodes. For example, in the string “are”, there will be an edge from node to node to node . That is, node will be the parent of node , and node will be the parent of node .
The following illustration can help you understand how the strings are stored:
Level up your interview prep. Join Educative to access 70+ hands-on prep courses.