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.

253 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
1answer
351 views

I'm really having a hard time with speller! Gives me a seg. fault. Please, help!

This is my code for load and valgrind points at line 127 as the reason for the seg. falut. Please, can someone point out to me why. Thanks.`/** *Loads dictionary into memory. Returns true if ...
0
votes
1answer
361 views

Pset 5 Load Function

I'm having trouble with my load function... I had it working previously, but after changing some stuff and dealing with the check, I ran into this issue and can't seem to figure it out... Every time ...
0
votes
1answer
133 views

pset5 speller load, please let me know if this makes sense

I'm having a really hard time with pset5.. I think I 'vaguely' understand the flow from the walkthrough, but it's really difficult for me to implement it in code.. I tried to 'collage' every element ...
0
votes
1answer
86 views

singly-linked list issues

this is not directly related to the problem set, but maybe somebody can help me out nevertheless. I'm trying to understand the singly-linked list and so I've attempted to write one on my own, based on ...
0
votes
1answer
61 views

Check50 error specification?

So :) dictionary.c, dictionary.h, Makefile exist :( speller compiles \ expected output, not standard error of "dictionary.o: In function `check':\n/va..." The code is working (not as fast ...
0
votes
0answers
113 views

How can I write a recursive function if that function's parameter is void? - pset5 - unload

Per the specification, we are not allowed to alter the declarations of load, check, size, or unload in dictionary.c or dictionary.h. Yet in Zamyla's walkthrough for unload, if one implements with a ...
0
votes
1answer
107 views

Pset5 distribution code

I'm in the middle of implementing Speller, I've just got the 'Load' to work in a separate test file. My question is how to insert the function into the distribution code? That is: How can I ...
0
votes
1answer
302 views

Submitting pset5 to the new CS50 2017 grade book

I had started pset5 before the introduction of the new course material for 2017 and the gradebook. The have finished the pset5 of 2016. My question is whether I can submit my pset5(2016) to the new ...
0
votes
1answer
84 views

PSET5 : My program outputs wrong number of misspelled words

#define MAXH 145709 int total_words = 0; typedef struct node { char word[LENGTH + 1]; struct node* next; }node; node *hashtable[MAXH]; // djb2 by Dan Bernstein unsigned long hash(unsigned ...
0
votes
1answer
81 views

load function in pset5 (segmentation fault)

These are my codes for the check and load functions. bool check(const char* word) { // TODO node* trav=root; char c; //char s[100]; //strcpy(s,word); for(int i=0;i<strlen(word);i++) {c=word[i]; ...
0
votes
0answers
126 views

pset5 load() and unload()

I need some help in spotting where is the problem in my load and unload functions and if the logic is correct. Also, whenever I execute valgrind and its telling me: definitely lost: 8,013,040 bytes in ...
0
votes
1answer
202 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
103 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
0answers
53 views

pset5 unload segmentation fault

I am getting seg fault. I am not being able to determine error by debugger. bool unload(wordtree* del) { if(del==NULL) return true; for(int i=0;i<27;i++) { if(del->ptr[i]!=NULL) { ...
0
votes
1answer
60 views

Pset5 problem with load function : Keeps getting segmentation fault

I have been working on pset5 and i keep getting segmentation fault while trying to implement 'load' function. I cannot really see where is the problem. Any help will be really appreciated! Here's my ...
0
votes
1answer
152 views

CS50 pset5 unload trie segmentation fault

I am having problems with implementing unload. load works perfectly and I can use the check function. I have tried many ways of changing my code but it only creates an infinite loop and I have no idea ...
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
0answers
226 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
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
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
37 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
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
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
264 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
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
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
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
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
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
106 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
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
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
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
158 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
143 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 ...
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
0answers
239 views

Check50 on speller

My version of speller works fine against various text files. Ralph.txt reports one misspelled word as the keys/ralph.txt file specifies. But running chek50.speller against my code produces errors, ...
0
votes
1answer
105 views

expected output, not standard error

My program compiles and runs fine. There isnt even much memory leak. But still it doesn't pass the cs50 check. Link to my check code
0
votes
0answers
100 views

Apostrophe's not working in pset5

The dictionary works perfectly fine using a simple dictionary and text until I include an apostrophe in the dictionary at which point I get a seg fault in my unload function. The unload function works ...
0
votes
1answer
128 views

PSET5 : Unload Invalid Next Size

I have been having a problem with PSET5 in unload, where it is giving me an error: * Error in `/home/ubuntu/workspace/pset5/speller': free(): invalid next size (fast): 0x00000000006042d0 * ...
0
votes
1answer
80 views

Help with seg fault in pset5 speller

My speller seg faults at the space following the first word in whatever input text I use. Here is the gdb output for austinpowers.txt with the segfault just after reading the word AUSTIN: 107 ...
0
votes
1answer
125 views

pset5 check-all misspelled?

I have the following code for check. I'm testing it against dictionaries/small and a test.txt and all words are coming back as misspelled? I don't understand why all words are coming back misspelled? ...
0
votes
0answers
115 views

Pset5 problem with grading

Can anyone tell me if there is an issue with pset5 grading? I submitted my code two days ago and it passes all tests in check50 besides the last one. I couldn't finger out that one! My grade came back ...
0
votes
2answers
78 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
137 views

Speller.c - need help on check

For an unknown reason some words that are in the dictionary and in the text file as well are marked as misspellings in the statistics. Though, the code passes check50 except the last paragraph saying ...
0
votes
2answers
158 views

Segfault in pset5 in load

My implementation of load uses a trie and when I attempt to access the bool is_word I get a segfault. Can you guys help me out? Any suggestions on how to improve my code would be amazing. Thanks ...