Questions tagged [trie]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
41 views

How Do I insert information into a trie?

I'm trying to insert true into the second branch of a node. #include <stdbool.h> #include <stdio.h> #include <stdlib.h> typedef struct node { bool correct; struct node *...
0
votes
1answer
47 views

pset4 speller trie - Code passes check50 but the output does not match the staff output

Check50 returns all happy faces but my program doesn't find as many mispelled words as it should. I'm not sure if the problem is my check function or my load function I tried checking witih debug50 ...
0
votes
1answer
47 views

PSET5 Dictionary code compiles but doesn't run as expected

I have been sitting on this pset for weeks but i have not figured what i wrote wrongly.. I implement the solution to this problem using a trie, however i think my trie is not properly linked/connected....
0
votes
1answer
47 views

pset5 check fails possessives and substrings

Ok, so I'm stuck... I finally (hopefully?) got load to work correctly, ie no leaks or errors with valgrind, but now check is giving me a hard time. I only have 135 words misspelled; and it I fails ...
0
votes
1answer
38 views

Want to ask about a trie

I have referred various resources but still have a doubt regarding tries. Do characters actually get stored in a trie? ( i think the answer is no) Suppose we are storing CAT and CAB in a trie. We ...
0
votes
1answer
25 views

Segmentation fault, speller trie pset 4

I'm getting a segmentation fault where i set node *new = malloc(sizeof(node)) I don't understand why I'm getting this fault, i am just allocating new untouched memory with malloc. // Implements a ...
0
votes
1answer
109 views

Pset 5 (speller): Problem with compiling due to 'declaration shadows a variable in the global scope;

I am using the trie structure for doing the pset5 speller. However, my program can't compile due to 'redefinition of node' in 'typedef struct node', and 'declaration shadows a variable in the global ...
0
votes
2answers
74 views

PSET5 Speller Trie Errors

So far, all other methods except check have already been implemented properly in my code. The problem with check is that it only returns true a lot fewer times than expected, which means that most ...
0
votes
1answer
485 views

Pset5 speller trie

There is a problem with my load function which i cannot wrap my head around. I can run speller however because of this one problem, my misspelled words is always more than the actual value. What is ...
0
votes
1answer
104 views

Trouble with Substrings in Check in Pset5

I have used a trie structure to implement my dictionary in pset5 and I believe my load() function is operating correctly, however I seem to be having trouble with checking substrings in the check() ...
0
votes
1answer
302 views

pset5 speller trie load - Dictionary not loading

I am working through pset5 using the trie data structure and it has been very challenging. I finally have code that compiles but when I run it against cat.txt using the small dictionary it returns all ...
0
votes
1answer
188 views

PSET5 Dictionary.c issues with implementing Load using trie

I've written some lines of code to implement the trie alogorithm for loading the dictionary. I'm facing the following issue: Compiling speller.c is giving me some errors, one of which is the below: ...
0
votes
2answers
80 views

pset5 check wrong if condition

This is how code looks before functions in dictionary.c typedef struct node { bool is_word; struct node* children[27]; } node; node* root; The load function works fine, but when the program ...
0
votes
1answer
297 views

pset5 load with a trie Killed

I'm having a lot of trouble with my pset5. I'm attempting to use a trie to load the dictionary. It will compile but nothing really more than that. when using gdb, the program shows "Killed" in the ...
0
votes
1answer
351 views

Pset5 speller: how can I navigate through the Trie and free the nodes?

so I am stuck on this PSET5 speller for a quite while now, trying different approaches, looking at available information in CS50, shorts, pset problem explanation and I couldn't get to free all the ...
1
vote
1answer
531 views

Pset5 Speller load() function completely stuck (trie)

I am completely stuck on pset5 load() function, have no idea where to go. Can someone please guide me in the right direction? Here is my code: bool load(const char* dictionary) { // TODO FILE* file = ...
0
votes
1answer
115 views

recursive trie generation segfaultin

Halp, I'm trying to implement a clever and zippy recursive trie makin function for load() in pset5, but my program's exploding when I trie, and I'm struggling to educe the problem (probably an ...
0
votes
1answer
282 views

pset5 speller (using tries)

When I run my program, the program output every single word in the text instead of solely misspelled words. I'm fairly confident the problem lies within my load function. Can someone identify anything ...
0
votes
1answer
726 views

pset5 trie load function killed with large dictionary

This has been bugging me for weeks. The program seems to run OK with small dictionaries, but gets killed with medium size - after around 95,000 words - it varies. LETTERS is set to 27. Any help would ...
0
votes
1answer
203 views

Pset5 Unload - Recursion with Tries - Fails Valgrind with apostrophes

I'm getting a strange problem in my unload() code, or more specifically the freeNode() recursive function that unload() calls. I think I have the recursive part of the function nailed; once free(...
0
votes
1answer
108 views

Pset 5 Dictionary TRIE Segfault

I know posting the while code is not cool, but I frankly can't figure out what is wrong anymore. I should have done this with something easier than trie-structure, but since it is close to done I'd ...
0
votes
1answer
548 views

Insert nodes into trie for Load

I'm not quite sure how to iterate through a string and malloc a new node to properly insert each letter into a trie for pset5/6 (2014/15). Here is the relevant code that I've come up with so far, ...
0
votes
1answer
136 views

Pset5 Unload will not compile

I am still stuck on pset5 speller.c. I am trying to implement unload via tries. I have tried several different codes which were not giving the correct output, but the last one I did could not even ...
0
votes
1answer
232 views

How do I load words in speller that are mixed letters and numbers?

I'm struggling with pset 6 (quite difficult logical and implementation wise, but I like this level of difficulty and this challenge). I'm implementing load and I just found out that I'm 34 words off ...
0
votes
1answer
93 views

Logic Error in speller.c - Can't open text file and also have doubts about load() and check()

I wrote check() and then I tried to test speller with dictionary/small and a text file I'd written myself, but the text file couldn't be opened. Is there a problem with the way I implemented load() ...
0
votes
1answer
65 views

cs50 pset4 speller trie word too long "index 46 out of bounds for type 'char [46]'". Isn't that handled by the code already written?

My code is giving all the right answers (lalaland.txt), but valgrind says: ==9947== dictionary.c:69:25: runtime error: index 46 out of bounds for type 'char [46]' (and I printf the problem - too ...
0
votes
1answer
40 views

PSET5: Trying to implement dictionary.c using trie. But segmentation fault in check()

My implementation compiles but I am getting a segmentation fault when I execute. My program is working fine through the load function because the output screen shows this "~/pset5/speller/ $ ./...
0
votes
1answer
24 views

trie speller check() function no mispellings

working on check() function and my trie data type seems to load ok with the full dictionary but check is unable to find any mispellings for a text file. I beleive I'm not correctly returning false ...
0
votes
1answer
96 views

Pset4 Speller, Trie. Why are all words misspelled?

first time poster and new beginner. I realize this question has been asked numerous times among different forums, but still after looking at other's code, I simply can't figure it out. I have ran my ...
0
votes
1answer
32 views

pset4 speller trie segmentation fault

I am doing the trie version of speller in pset4 and keep getting a segmentation fault. I have run my code on short dictionaries and short text files and it seems to work just fine but when I try ...
0
votes
1answer
25 views

trie speller works on custom dict but misses mispellings on large dictionary

So my speller works fine with a custom dict, but not with the large dict. This is my code in dictionary.c (haven't modified other files): // Implements a dictionary's functionality #include <...
0
votes
1answer
63 views

Stuck with Unload using trie

I could not unload the dictionary, and still don't understand why. It seems that it is not freeing what I think. I would really appreciate some help, here is my code: // Unloads dictionary from ...
0
votes
1answer
47 views

Speller TRIE - all words misspelled?

I've hunted through StackExchange for similar questions and their advice but I'm still struggling to understand why my speller keeps throwing back all the words as misspelled? Would be massively ...
0
votes
0answers
47 views

Problem with pset4 2019 trie dictionary

I'm having problems with my trie dictionary.c file, if I try to run the whole program normally or through gdb, I'm getting no errors whatsoever and I'm getting the right answers. Tho, when I try to ...
0
votes
1answer
55 views

pset4 speller unload trie leaking memory

I can't seem to figure out why my code is leaking memory, I think I have implemented recursion correctly, take a look at my unload code. EDIT : I tried running my file with large dictionary and using ...
0
votes
1answer
35 views

Pset5 Trie Segmentation fault

Have been trying to debug this for days and eventually came down to the following problem: When running an example test(lalaland.txt) the misspelled words are fine up until the program abruptly stops(...
0
votes
1answer
39 views

valgrind() causing IDE to shut down

working on pset4 speller via trie. I AM AWARE OF THE CLANG BUG. According to one of the answers in the original question i removed the -fsanitize flag and ran valgrind() on it while using a small ...
0
votes
1answer
203 views

pset4/speller/trie

Since there was no help I repeat my question...I have a weird problem in speller using trie.... when I tested it on my Ubuntu visual studio code it works and compiles when using a dictionary of 4 ...
0
votes
0answers
66 views

Speller Trie not reading apostrophes?

For a reason I have fruitlessly tried over and over to work out, my trie code, while functioning well in all other aspects, either is not reading apostrophes into its dictionary or is not properly ...
0
votes
1answer
134 views

Pset 4: Speller (trie) - misspelled words

I'm stuck. In Speller, implemented with trie, I get more misspelled words than I should. The number of words loaded into the dictionary is correct, there are no leaks or error messages. When checking ...
1
vote
1answer
51 views

Pset5-- program isn't checking all words, marks all words it checks as misspelled

I've been running the code with the small dictionary and a sample text of "cat hgsgk caterpillar", so the code should theoretically return a wordcount of 3, and hgsgk as the only misspelled word. ...
0
votes
1answer
265 views

PSET5 speller - I cannot understand tries at all

I am so completely lost. I completed PSET5 with a hash table, and the concept of hash tables makes sense to me. Now I am attempting to do it with a trie, and I am just so confused I don't even know ...
0
votes
1answer
61 views

cs50 speller trie: (in c language) can't figure out what i'm doing wrong with load. Seems to work but seems non-existent in other functions

sorry if I am asking the question in a wrong way or my code is too messy I am knew here. My problem is that it looks like load works and the dictionary is loaded into the trie but check and unload ...
1
vote
1answer
582 views

Speller(trie) / my code can't handle most basic words and substrings properly

I need help. When I check my codes through check50, I got a result like below :) dictionary.c and dictionary.h exist :) speller compiles :( handles most basic words properly expected "...
1
vote
1answer
113 views

pset4 - speller trie load - ptr not linking up

I have been stuck on the load part of the speller exercise for the tries table. I have gone through a lot of the existing questions and come to the following code: while (fscanf(file, "%s", word) != ...
0
votes
1answer
79 views

Pset5 load - Stuck in infinite nested while loop

I have been working on this problem set for some time. At the moment I am stuck at figuring out why the nested while loop is infinite despite of the fact that there is an fgetc() function that runs ...
0
votes
1answer
168 views

Memory leaks in Speller

My program passes all tests except the valgrind check. I tried to find the cause of errors, but valgrind is too 'obscure' for me yet, I don't know what to do. I guess some memory isn't freed, but I ...
1
vote
1answer
331 views

Pset5: Need Help with Check

My 'Check' function outputs words that are not misspelled and skips over the ones that actually are. It also doubles the words that it outputs. For instance, in a sentence "There was once a catapillar"...
0
votes
1answer
172 views

pset5 "words in dictionary" is 0

I'm not having much luck troubleshooting my speller code. It returns the correct misspelled words and words in text, but words in dictionary returns as 0. I ran valgrind and it said there is a leak in ...
0
votes
1answer
152 views

Pset5 Speller : Check gives segmentation fault : Tries

I am not getting where the segmentation fault is happening. // Implements a dictionary's functionality #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <...