© Elshad Karimov 2020
E. KarimovData Structures and Algorithms in Swifthttps://doi.org/10.1007/978-1-4842-5769-2_9

9. Trie Data Structure

Elshad Karimov1 
(1)
New York, New York, USA
 

In this chapter, we will review Trie (pronounced as try) data structures and how to implement it using Swift. A Trie is a tree-based data structure that organizes information in a hierarchy. While most of the other structures are designed to manipulate generic data, Trie is often used with Strings it is used for storing words in a way which enables fast lookups. Since Trie stores characters at each node, it is very efficient for prefix matching in the English language.

Why a Trie?

A Trie is very useful for storing the English language, and it has the following advantages ...

Get Data Structures and Algorithms in Swift: Implement Stacks, Queues, Dictionaries, and Lists in Your Apps now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.