Questions tagged [pset5]

The problem set for Week 5 will challenge you to apply what you've learned about pointers, memory management, file i/o and structs, creating more complex data structures (such as Hash Tables or Tries) and leveraging their power to write a lightning-fast spell check algorithm.

Filter by
Sorted by
Tagged with
0
votes
0answers
230 views

Pset5 speller.c valgrind errors in load and check

I have problem with speller.c. Check50 shows that everything is good but when I run valgrind there are a lot of errors. There are no memory leaks, but number of errors is huge. I ve already search for ...
0
votes
1answer
158 views

speller.c - understanding the checking part

This post is not about some issue I have with my own code but rather to understand the logic of the course's code. In this code, which is a segment of the file speller.c, I cannot understand why ...
0
votes
1answer
143 views

pset5 unload printed failed to unload but pass valgrind with no leak?

I'm sooo close!! My code is running and printing out misspelled words but stopped at message "could not unload dictionary" (I tried on both large and small). However when I run Valgrind, it's ...
0
votes
1answer
82 views

Pset5 compile but report segmentation fault inside load

HELP!! I'm finally able to make my code compile without error. I know it won't guarantee it'll work, but at least I can move to the next step. :-) When I run the code it gives me segmentation fault in ...
0
votes
1answer
152 views

Pset 5 - dictionary.c - Trie

I want to create a trie for this pset and need a nudge in the right direction. I have created a struct node and malloc space for the 'root' struct. Now I think I want to populate each node in the root ...
0
votes
1answer
145 views

CS50 PSET5 Memory Leak (updated2)

I had posted two questions regarding memory leak in Problem Set 5, available at CS50 PSET5 Memory Leak and CS50 PSET5 Memory Leak (updated). I got amazing feedback from different people (and I ...
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

pset5 can't share a pointer from load() to check()

I've implemented check() and load() using tries. I have a pointer 'head' to the top of the dictionary trie (NB it's called root in the walkthrough) that I need to pass from load() to check() I ...
0
votes
1answer
164 views

CS50 PSET5 Memory Leak

I have spent more than 30 hours on this problem set and I am still struggling. At first, my program compiled but did not run, due to a segmentation fault. I finally fixed it and everything works fine, ...
0
votes
1answer
134 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
435 views

Pset 5 implement load with trie

can someone help me please figure out what am i doing wrong with imlementing the load function: 1.when i try to run the program i get a "killed" massage. 2. it looks like i have a leak of memo but i ...
0
votes
2answers
216 views

Help With Pset5 Unload (Valgrind issue)

I hope you are well. I am now on Pset5's unload function and have run into a blocker. When I run valgrind on it, here's what happens: http://pastebin.com/45XHAcPj I cannot see what the issue is. ...
0
votes
1answer
102 views

Segmentation fault..Please Help

can anyone have a look at my code, find the problem and suggest improvements. im getting segmentation fault after calling 'check' function. typedef struct trie { bool word; struct trie* link[27];...
0
votes
1answer
86 views

pset5 speller problem

so I am having problems implementing speller, particulary load function. I could find that immediately after I open a dictionary is sets file poiter to NULL, and I don`t know why. Really hope for your ...
0
votes
1answer
278 views

Pset5: files compiled but report segfault when run. I'm completely lost

I've been doing this pset for 3 weeks. This is the hardest pset ever. The segfault seems relevant to the free_node() function. But the valgrind report is full of confusing jargon. I'm completely lost. ...
0
votes
1answer
234 views

pset5 unload recursion causes memory leaks

In pset5, I have made load (using a trie), check and size run successfully, even my whole codes passed check50. I believe so because when I do spell check a text using the big library, I get the same ...
0
votes
1answer
214 views

PSET5 - load stutter with hash tables

Would you consider this as a good hash function and load function? It seems rather slow not sure where is the biggest problem here :( Running time is around 0.8s. I am trying to make hash table ...
0
votes
1answer
890 views

pset5, have a seg fault but valgrind reports no error

I think I have load, check and size function running successfully. However, my code meets seg fault again. Valgrind reports: ==5654== Stack overflow in thread 1: can't grow stack to 0xffe801ff8 ==...
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
44 views

PSET5, question about traversing of a single linked list

I would like to ask what could I do to get rid of this one memory leak from valgrind I have tried to clear crawler->next as this is where it points me. I didn't think this would be the case but tried....
0
votes
1answer
77 views

My speller only deals with one word, despite me setting a new node for each iteration in load

This is my code for load and check... The speller finds only one word in the text then returns all the others as misspelt. I have seen someone here struggling with the same problem, and his/her issue ...
0
votes
1answer
17 views

PSET5 valgrind + exit out of program problem

The problem now exist only if I am trying to free up the memory used for file "d". I am getting 14 errors from 14 contexts errors are as I am showing below ( the unbuffer write one also happens for ...
0
votes
2answers
64 views

PSET5 problem cs50 check

I am done thank you for your help with this pset:) :) dictionary.c, dictionary.h, Makefile exist :) speller compiles :) handles most basic words properly :) handles min length (1-char) words :) ...
0
votes
1answer
37 views

Probem in running pest5 URGENT!

i have dry runnned all the dictionary asssociated functions but there is a problem in opening the text files itselF /** * dictionary.c * * Computer Science 50 * Problem Set 5 * * Implements a ...
0
votes
1answer
146 views

PSET 5, Segfault in load

When I run speller I get a segmentation fault - I am pretty sure that the error is in this excerpt of my load function. I don't understand why; hashtable is an array of node pointers. Then new_word is ...
0
votes
1answer
88 views

pset5 spellcheck, problem with load

Could someone please review this code as I am not sure why am I getting segmentation fault while trying to use ' in words in a dictionary. I am attaching the code of my load function. //////////////...
0
votes
0answers
235 views

pset5 Check50 failing: \ can't check until a frown turns upside down

Just when I thought I had completed my pset5 I got this error when I ran check50, although it passes all the manual tests like comparing the words with staff solution and etc, I made a seperate load.c ...
0
votes
1answer
151 views

Do I have to declare 26 Heads if my hashtable is of size 26?

I have just started pset5 and for the implementation of the function load i was practicing on the smaller dictionary with making another .txt file and filling it with 3 words for each alphabet, The ...
0
votes
1answer
262 views

All words are misspelled in check

I have been looking at other questions like mine but none of the answers have helped me so im asking myself. I have been debugging for awhile and im pretty sure the problem is that im not accessing ...
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
156 views

load check & unload

I've been trying to implement load using trie but I have been told that I have something wrong with the place of my declaration of root and with the way I'm handling EOF. I'm trying to fix it but I ...
0
votes
2answers
54 views

Spellcheck using linear search with arrays not finding misspellings

I am trying to check if I have the basics of the speller program down by first implementing it with linear search. My plan is to get this right then work on a more efficient speller with a trie/hash ...
0
votes
1answer
11k views

'invalid read of size 8' given out by valgrind

Everything is working bar this issue - program compiles, passes check50 and gives the correct output. However, when I run valgrind while checking a large text, e.g. tolstoy.txt, towards the end I get ...
0
votes
0answers
47 views

check50 prompts “killed by servor” in pset5

I am currently working on pset5. I think some infinite looping is going on in my program. Below is my code(i will remove it afterwards). can anyone answer which part of my dictionary.c program needs ...
0
votes
0answers
83 views

having problem in load in pset5.valgrind says Conditional jump or move depends on uninitialised value(s)

bool load(const char* dictionary) { FILE* fp=fopen(dictionary,"r"); if (fp==NULL) { printf("Could not open dictionary"); return 2; } for (int i=0;i<SIZE;i++) ...
0
votes
1answer
108 views

All words not getting loaded in speller.c's dictionary

This is my load function: #ifndef N #define N 200 #endif #ifndef LENGTH #define LENGTH 45 #endif #ifndef LL_LENGTH #define LL_LENGTH 1000 #endif typedef struct node { char word[LENGTH+1]; ...
0
votes
1answer
55 views

pset5: load changes previous trie vlues, seg-fault on large dictionary

I've been struggling with this pset for long and still no luck. My code works with small dictionary but when using large dictionary unload function gives me seg-fault (I hard coded return true in ...
0
votes
0answers
33 views

Submission gets stuck

When i am trying to submit a pset, it gets stuck like shown in the image and doesn't proceed further. This is happening for pset5,pset7 and pset8.
0
votes
2answers
132 views

What does free all pointers in children mean? (Unload function in Pset 5)

In the walkthrough video, it is told that we should free all pointers in children (trie). Does that mean that all pointers should be set to null? My program passes CS50 and valgrind doesn't indicate ...
0
votes
0answers
64 views

pset5 misspelling check50 fails while the results are the same as stuff's on all texts

The program I wrote (see below) gives correct (fast and identical to stuff's) solutions on all texts I tried (at least 5). However, check50 gives a following error while failing "handles possessives ...
0
votes
0answers
101 views

pset5 load function not working

While debugging it is breaking out of the first loop of my load function.It is giving "Killing all inferiors" bool load(const char* dictionary) { root = (LINK)malloc(sizeof(NODE)); for(int k ...
0
votes
1answer
114 views

CS50 pset5 mispellings segmentation fault

I finished the code for load() and check(). It seems to me that load() works fine. But when I finished check() and ran the program, segmentation fault appeared. Then I used Valgrind and here is one ...
0
votes
1answer
150 views

Unload function segmentation fault

I have implemented the spell checker using tries. But while unloading it is giving a seg fault The structure is defined as struct node; typedef struct node NODE; typedef NODE* LINK; struct node { ...
0
votes
1answer
58 views

pset5 spellchecking:load

I am working on pset5 load, and I am getting segmentation fault whenever I try to run speller. Any ideas on what I need to change? /** * Loads dictionary into memory. Returns true if successful else ...
0
votes
1answer
263 views

Unkown error with speller.c

I get a for my unkown error when I try to compile dictionary.c. The problem lies in my implementaionof check. Here is my code: int charNumber(char c); typedef struct node { // bool Alphabet ...
0
votes
1answer
86 views

PSET5 speller.c not getting properly graded

https://ide.cs50.io/gauraviit/ide50 This is link to my cs50 ide I had submitted by cs50 pset5 solution but I'm getting 0 graded. when I ran the check that cs50 has given my code passes all the test ...
0
votes
1answer
191 views

Segfault in Dictionary.c

So I have been getting a segmentation fault somewhere in my code. WHen I run the debugger, it gives me the following: /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): ...
0
votes
2answers
47 views

Leaks and Invalid read and write with dictionary.c help!

I am on PSET5 Dictionary and the program runs, not as efficiently as I would like, but I have memory leaks in the load function and invalid read and writes. I am unsure what I am doing wrong as it ...
0
votes
1answer
159 views

SEG FAULT in check

This is my check function typedef struct node { char word[LENGTH+1]; struct node* next; }node; static node* table[N]; bool check(const char* word) { for (int i = 0; i < N; i++) ...
0
votes
1answer
145 views

submitting-pset5-for-proper-grading

Submitting pset5 for proper grading I rolled everything into dictionary.c - still not seeing my grade changes from 0. I cant tell if the pset is still not graded or is the grading system changed ...