Questions tagged [trie]

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

Tries are specialized data structures where a word can be stored as a sequence of characters. Reading the word involves traversing down the branch of the tree. At each node, the possible completions of the partial word can be found by traversing down all possible paths to the leaf level. It is useful for implementing dictionary based functionality such as autocomplete.

1108 questions
-3
votes
1 answer

Trie implementation in c

I am implementing multibit trie in C. When I run the code, I get run-time error: bus error (core dumped). I am getting this error when I am adding different nodes through calling insert_rule method. I wrote comments in code to understand. This code…
explorer
  • 737
  • 1
  • 8
  • 23
-3
votes
5 answers

HackerRank - No Prefix Set not passing all the test cases

I was trying to solve No Prefix Set problem on HackerRank. My Solution is passing for only half of the test-cases. I am not getting what I am missing here. Problem Statement: Given N strings. Each string contains only lowercase letters from a−j…
YoungHobbit
  • 13,254
  • 9
  • 50
  • 73
-3
votes
1 answer

Complexity of trie

How is a trie useful if one has to at least read all the characters from the input array of strings to insert the strings one by one into the trie? So the complexity is O(size_of_array). Suppose the input array of strings is…
-4
votes
2 answers

How to write a 6 dimensional array of different sizes?

I am trying to write a struct in c that stores data in a linked array like this: typedef struct { u8 num; struct value* next; }value; value arr[4] = { {.num = 0, .next = (value[]){ …
erano
  • 374
  • 1
  • 6
-4
votes
1 answer

How to find if a given input is a meaningful word or not

I am trying to solve a problem where i have given a text file with words followed by newline charecter I need to write a function which takes input as a string and should return output true if it is a meaningful word else false. My attempt of doing…
Srisa
  • 269
  • 1
  • 3
  • 9
-4
votes
1 answer

Wrong Answer for SPOJ PHONELST

Here is the link to the problem: http://www.spoj.com/problems/PHONELST/ The judge gives wrong answer around the second set of test cases. Here is my code for the problem, please help me out.Thanks in advance. #include #include…
Vignesh
  • 21
  • 3
-4
votes
1 answer

need help in implementation of trie in c++

class node { public: node(){ value = 0; arr = new node*[26]; for(int i =0 ; i<26;i++) arr[i]= NULL; } int value; node ** arr ; }; class trie { public: trie(){ root…
-4
votes
1 answer

Fast .NET serializer for a big trie

We have a big trie in our server-side service which has something like tens of millions of nodes. Whole trie takes about 4 gigs of RAM. Until now we used only the basic binary .NET serialization for storing the trie in a file and reconstructing it…
eeq
  • 884
  • 1
  • 6
  • 15
-4
votes
1 answer

Codeforces 4C Runtime Error

Hi I'm using a Trie implementation to solve this problem, but oin the codeforces' servers I'm getting runtime error, and on my pc and on Ideone is normal. Any Ideas ? http://codeforces.com/contest/4/problem/C https://ideone.com/dvRL3b #include…
Guthyerrz
  • 27
  • 5
-4
votes
2 answers

dictionary/tree fast key based lookup

I have a database of 20000 domain names, including Top Level Domains, Second-level and lower level domains. For example .biz stackoverflow.com ru.wikipedia.com I would like to perform fast lookups to see if input URLs match any of these 20000. I…
jjarv
  • 71
  • 6
-5
votes
1 answer

Making a trie with continuation classes

Can somebody teach me how to make a Python trie with continuation classes? Implement a trie (letter tree) with continuation classes to represent the regular verbal paradigm of French (regular verbs ending in -er and -ir). The program is…
-6
votes
1 answer

Unresolved compilation error

Here's my code for insertion of a node in a compressed suffix trie : public class tree { char a[] = new char[10]; a[0]='b'; a[1]='a'; a[2]='n'; a[3]='a'; a[4]='n'; a[5]='a'; a[6]=' '; protected node root; …
-7
votes
2 answers

Break a String to a String of valid words using a dictionary

The problem is as follows: You are given a dictionary which contains a list of words and has the method .contains() which returns a boolean indicating if the word is in the dictionary or not. The actual implementation of the dictionary doesn´t…
user132226
  • 11
  • 1
  • 1
1 2 3
73
74