Coders Packet

Trie Implementation in C++

By Gaurav Sawant

An implementation of Trie in C++, which is an efficient way to perform search queries on strings.

I have implemented a Trie Data Structure in C++.

A Trie is an efficient data structure for efficient retrieval of information and becomes especially very useful when we need to perform multiple search queries on strings of varied sizes.

This data structure is widely used in the Autocomplete feature used in IDEs, Code Editors & Mobile phones as well.

 

I have implemented two functions that can be directly used for performing actions on the Trie.

1. insert()

Required parameter: string to be inserted

Inserts the string into the Trie

 

2. search()

Required parameter: string to be searched

Returns true if the string is present in the Trie, else returns false.

This Trie class can be directly used for implementing of the Autocomplete feature of some website / application.

Download project

Reviews Report

Submitted by Gaurav Sawant (GauravSawant)

Download packets of source code on Coders Packet