My Two Cents

A blogging site from a hacker.

Learn the Trie Data Structure

Introduction

Trie is a tree data structure, which is very useful in many aspects, such as word count and statistics. It stores data in sorted order, so its retrieval is faster than other data structures in some cases. This tutorial introduces some resources of helping to learn and understand this data structure.

Comprehensive Overview

The most comprehensive source to learn trie is this page from Wikipedia. This wikipage describes its pronunciation: ‘tree’ or ‘try’, its applications in dictionary representation, sorting, full-text search and many others.

Trie in an Algorithm Book

Trie is covered in this Java algorithm book. This book introduces 50 algorithms that developers should know. The source code is shown online at http://algs4.cs.princeton.edu/code/

Nice Illustration of Trie

Further more, Anna from Toptal posted a very nice page of Trie. In her post, a simple game is used as a vivid example to show the usefulness of Trie. Then, some more decent and clear illustration figures were given out so that it is easy for readers to understand this data structure and its performance in advantage. I highly recommend that readers who want to learn Trie read her post and source code.

Comments