A tree-like data structure used to hold an associative array, also called a Prefix Tree.

learn more… | top users | synonyms

5
votes
1answer
58 views

Spell Check and Trie implementation

I have written this code for an Edx course called CS50x (a beginner course). This problem set required me to write a program which: loaded a dictionary into some sort of data structure (I choose to ...
2
votes
1answer
28 views

Trie SPOJ Problem - PhoneList TLE

In this problem you are given input of phone numbers and you are supposed to determine whether any number is the prefix of another. I have an addchild method that ...
4
votes
1answer
47 views

Trie string iterations

\0 / \ a b-a-t-s /|\ m s t which contains [am, as, at, bat, bats] The goal I'm trying to reach is to iterate through the trie to find if there's a next ...
4
votes
2answers
225 views

Trie (tree form) in Java

I created a Java Trie as part of a project someone challenged me to do. I'm not sure that this is the most efficient way to go about producing a Trie, I know that this works but I was hoping someone ...
1
vote
1answer
460 views

Trie - code review request for improvement

Ok, code reviewers, I want you to pick my code apart and give me some feedback on how I could make it better or more simple. ...
3
votes
2answers
91 views

Improving Trie Implementation

This is an implementation of a trie, that I will be using on a code editor to parse keywords from a given programming language. I decided to use a trie when I asked this question, and the ...
2
votes
1answer
676 views

Next word prediction using n-grams

I have written the following program for next word prediction using n-grams. The data structure is like a trie with frequency of each word. Any suggestions are welcome, but I am more concerned about ...
7
votes
1answer
857 views

Simple trie implementation in JavaScript

After experimenting with a sorted trie implementation in C, I felt that I understood tries pretty well, but was having trouble explaining how they work. Since the C code was based on existing code, I ...
1
vote
1answer
136 views

Sorted trie implementation in C

I wanted to store some dictionary data (key/value pairs of strings) in C, and decided to use a trie. I found what looks like a good implementation here, along with some nice notes. In this ...
8
votes
3answers
553 views

Readability and Performance of my Trie implementation

As an interesting exercise in Python 3.3, I implemented a Trie (also known as a Prefix Tree). Example usages Create from list of key-value-tuples ...
3
votes
1answer
298 views

delete a key in a trie

To delete a key from a trie, there are four cases: For the explanation of trie data structure, please check the following link: http://www.geeksforgeeks.org/trie-insert-and-search/ (1) Key is not in ...
1
vote
1answer
262 views

Is this a valid implementation of trie Data structure?

i am trying to learn Trie Data Structure and just implemented it without giving much attention to the code standards , its a raw implementation , can you guys help me to understand whether this ...
10
votes
2answers
7k views

Implementation of Trie data structure accommodating varying number of children

I've used the Trie data structure to solve the following problem: Given an array of words, print all anagrams together. For example, if the given array is {"cat", "dog", "tac", "god", "act"}, then ...
0
votes
1answer
291 views

use trie data structure to solve the problem of clustering anagrams

Given an array of words, print all anagrams together. For example, if the given array is {“cat”, “dog”, “tac”, “god”, “act”}, then output may be “cat tac act dog god”. The following is my c++ ...
6
votes
1answer
2k views

A trie implementation for left to right wild card search

I was working on a task to implement auto suggest from an array of couple of thousands of strings. Ofcourse the first and the easiest implementable was to go through each element and do ...