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
1answer
134 views

pset5 Mispellings. Outputs are correct but check50 complains

This is the result of check50: https://sandbox.cs50.net/checks/7848930a98684a8ea4c41091c5c15a2d Problems arise with "the" and "foo". I tried to check every combination of The, tHe, thE ecc... and Foo,...
0
votes
2answers
508 views

a problem with declaring root

i have a problem with declaring root. first I wrote a trie struct in dictionary.h and declared a root nodenode* root = NULL;. and then i allocated memory for root in mainroot = calloc(1,sizeof(node));....
0
votes
1answer
177 views

pset 5 memory leak - how struct definition may be related

I saw a similar question about memory leaks with speller "pset5 valgrind memory leaks", but that poster found a solution that doesn't seem to work at all for my program. Just like that user, I get ...
1
vote
2answers
634 views

pset5 speller valgrind still reachable

I'm using a trie data structure to tackle the spell checker. The code works fine and is almost as fast as the staff's implementation. Even check50 is happy about it. But when I run valgrind it throws ...
0
votes
1answer
423 views

Why does check find so many misspellings?

I used the following functions in speller, but, when I ran the program with the Constitution as text it gave me something like 6900 misspellings out of 7500 words. I don't understand it since I made ...
0
votes
2answers
102 views

Dictionary.c problems (still not working)

My code works fine when I don't use the large dictionary, but when I do use it, I get a segmentation fault. When I use GDB, the problem is so far into the dictionary that it would take forever to get ...
1
vote
1answer
62 views

pset5 - speller - valgrind says that there is one block left to free

I have the speller up and running, working properly and passing the cs50 automatic verification, but, independently of the size of the dictionary (even with a one word dictionary or an empty one) ...
0
votes
1answer
146 views

pset5 dictionary.c not working

In my dictionary.c file, I declared my own function called trieNavigate(), whose code is below. I use it for loading and for checking, and so it returns a bool and accepts 3 parameters: a char (that ...
1
vote
1answer
34 views

Appending function failed

I tried to implement a function to append nodes to a linked list using the hints on cs50 study but all i get is (runtime error). Here's my code #include <stdio.h> #include <stdlib.h> #...
0
votes
1answer
99 views

Use of uninitialised value on function argument

On Pset5, I get this error on Valgring and I cannot figure out how to resolve it... ==26776== Use of uninitialised value of size 4 ==26776== at 0x80494AB: trim (dictionary.c:334) ==26776== by ...
0
votes
1answer
107 views

Pset 5 Resize - Fail in all tests

The result of resize seems identical to the staff's one. resize.c /** * copy.c * * Computer Science 50 * Problem Set 4 * * Copies a BMP piece by piece, just because. */ #include <stdio.h&...
2
votes
3answers
2k views

what does `while ((c = fget(fb)) != EOF && isalpha(c))` does?

what does that line do in speller.c? while((c = fget(fb)) != EOF && isalpha(c));
0
votes
1answer
126 views

completed speller however a bug(works fine with small data shows 0 misspelling with large dictionary)

Guys I have a very weird problem. I have practically completed the speller pset. And I was practising with a small dictionary it worked fine with a small dictionary but with a large dictionary I ...
0
votes
1answer
345 views

Running check50 pset5 speller problem

I`ve gotten the program to work, have not modified speller.c or the make file and no new includes. I`m getting identical results to the staffs version But when I run check50 I get the following ...
0
votes
2answers
299 views

Invalid read/write errors in pset5

I have been trying to create a trie for storing my dictionary, and the code looks like it ought to work. However, when I run Valgrind on it, I get a number of read/write errors (mostly of size 4). In ...
1
vote
1answer
298 views

How to add a new node in the linked list

Now that I am done with pset5 I would like to understand how to add a new node to a linked list. While building the pset, I blindly used Zamyla's guidelines on how to add a new node to a linked list ...
0
votes
1answer
538 views

pset5 misspelling result times

I completed misspelling and compared my results with those of the staff. Is there somewhere students are posting their result times? It would be interesting to see how fast other people's programs ...
0
votes
2answers
290 views

Valgrind errors at the end

I finally made my dicitionary.c work. It works all ok. But there are some errors at the end, when checking with valgrind, although it says no memory leaks. The error summary is: ERROR SUMMARY: ...
0
votes
1answer
37 views

Segmentation error with array of nodes

I don't understand why I am getting segmentation error. Is it because I'm setting the array to NULL? Though if I don't set it to NULL then the head of the list will always keep the value of zero. ...
1
vote
1answer
306 views

pset5 unload double free or corruption

* Error in `/home/jharvard/Dropbox/pset5/speller': double free or corruption (top): 0x0804c698 * If I set unload to always return true, load/check work perfectly. Valgrind gives me a lot of invalid ...
0
votes
1answer
244 views

Pset5 Dictionary lots of misspeled words

So I have a problem here, I have done everything but it is pointing a lot of misspelled words, although all the times and valgrind seems to be correct. WORDS MISSPELLED: 5067 WORDS IN DICTIONARY: ...
0
votes
1answer
100 views

Pset5 Load, special characters

I have a doubt here, In pset5 when implementing load function, do I have to load in any special characters beside the new line one?('\n') And how can I check the correctness of my function?
0
votes
1answer
445 views

Pset5, speller 'could not open text'

So I wrote my load function and everything looks good, so I had it return true so I could move on and test other parts of the program. My problem is that speller.c won't load my text. I made a custom ...
0
votes
1answer
245 views

dictionary.c spell checker not working correctly

I have spent a lot of time trying to fix my check() function but I can't figure out where it is going wrong. By using printf(), it seems that the passed in word sometimes does not match with the word ...
0
votes
1answer
200 views

implement hash table with linked list

I'am trying to implement hash table with linked list, as a dictionary. but when I print the word's after the insertion, all the places have the last word on the list. thank you for the help. #...
0
votes
1answer
272 views

pset5 Speller Unload Method, not sure where Im going wrong

I'm having issues with Unload at the moment, I am getting Seg error. I am moving tho the code with GDB and error occurs on a Null check i am doing in a while Loop. I am basically moving my transit ...
5
votes
1answer
966 views

Pset5: Misunderstanding tries and method to assign letter to an array inside a struct

Before posting, I've searched a lot here and there on the Internet to find the answers to my questions myself and I did code something that eventually works. My issue is that I've re-rewrote some ...
0
votes
2answers
430 views

Pset5 dictionary.c Load/Check with Tries — Segmentation Fault

I get a seg-fault when I execute: ./speller ~cs50/pset5/texts/austinpowers.txt > student.txt I think the problem is at Line 115-116 in Check() but I don't know why I have a memory access violation ...
0
votes
1answer
211 views

Check function error integer to pointer conversion

I keep getting this error but am at a loss as to how to solve it! It's driving me crazy and getting frustrated with it. incompatible integer to pointer conversion passing 'int' to parameter of type '...
1
vote
1answer
49 views

Internet not working in appliance

I recently updated my computer to Windows 10 and the appliance was still there and it opened and I was able to continue working on pset5. The problem arose when I was finished and had to submit the ...
0
votes
1answer
171 views

No such file or directory in pset5

I am having issues with pset5. I followed the write up and tried to make the code but i imediately get no such file or directory as a reply. Using ls shows all the files in the directory. So i don't ...
1
vote
1answer
295 views

PSET5: Segmentation fault in load function

I get a segmentation fault whenever I run the program with the large dictionary, but not the small one, so I guess the error lies somewhere in load or unload but I can't localize it. The program also ...
0
votes
1answer
60 views

Initializing multiple variables inside a for loop

I have been working on the dictionary's "load" function in Problem Set 5, but I have a problem. I don't want to hard-code names for each node within my trie, which I am working on, but in order to ...
0
votes
1answer
503 views

pset5 speller, check function returns all words as false

I've been tearing my hair out over this problem for three days now, and just can;t find where I'm going wrong. All seems okay with this program, it loads the dictionary file (using a trie), gets the ...
0
votes
1answer
593 views

Pset5 dictionary.c load Should I throw my code away or am I on the right track?

I battled the compiler for a full day to eliminate all the syntax errors in my load function. Does my pseudo-code look correct and does it match my code? Pseudo-code: each node struct contains a ...
0
votes
1answer
88 views

Speller Seg-fault with large dictionary [closed]

[code removed per academic honesty guidelines]
0
votes
1answer
184 views

pset5 Speller, Segmentation problem

So I finished speller and am debugging and getting a segmentaiton error when I am trying to set the array in my root node to NULL. I have defined my Struct at the beginning of Dictionary.c and ...
0
votes
1answer
84 views

Pset5 speller segmentation fault when adding to my linked list

I'm trying to implement the load function in speller, and receiving a segmentation fault. I have been careful to malloc all my pointers, so can't figure out what the problem is?? GDB says that the ...
0
votes
1answer
111 views

Trie: only last word of text saved (“is_word” overwritten?)

following problem: Say I have a dictionary (called mysmall.txt) with only those words in it: zoo zoom zoomzoom foobar And I have a text file (mytext.txt) with the exact same content as in mysmall....
0
votes
2answers
392 views

pset5 valgrind not happy with load (also, using malloc vs calloc on trie)

First, valgrind flags the file pointer at the fopen call, and also the malloc call to the root pointer. It designates both still reachable in loss record. Second, since for pset5 I check for an end ...
0
votes
0answers
55 views

pset 5 what am i missing

Im having trouble with the syntax and language for pset5, its driving me nutz. Say I have the word BAT:- OK so I have a root node. I check the root node to see if index 1 ( position 2 for the letter ...
0
votes
1answer
639 views

Speller - trie implementation - Segmentation Fault

Having some trouble with a trie implementation of speller pset5 (2014). It seems to almost work, finding misspelled words, but then I get a segfault. It appears I have some memory problems, and I ...
0
votes
1answer
277 views

PSET5 load function incomplete large dictionary load (Segmentation Fault)

I've tested my code extensively and it successfully loads the dictionary to the chained hashtable with both the small dictionary and with a subsection of the large dictionary, but when I try to load ...
3
votes
1answer
267 views

Code in speller.c

In speller.c, the line 89 is : while ((c = fgetc(fp)) != EOF && isalpha(c)); but shouldn't it be : while ((c = fgetc(fp)) != EOF && (isalpha(c) || c == '\''); because a word can ...
0
votes
1answer
157 views

Recursion doesn't work in pset5

Cannot work void freenode(node* in) { int children = 0; int save = 0; for (int i = 0; i < 27; i++) { if (in->children[i] == NULL) { children += 1; } else if (in->...
0
votes
0answers
350 views

PSET5 Speller: trouble with mispellings and tolower()

I am very close to getting my dictionary to word correctly, but I am having a small hiccup in my check function. In order to compare the word given in the check function to the dictionary, I first ...
0
votes
1answer
264 views

Pset5 dictionary.c is not producing correct output

I've implemented my load and check functions using tries. The program works fine and produces the output, but when I compared it against the output from staff's implementation, I found out that there ...
0
votes
1answer
195 views

2014 pset5: Double free in load

I can't seem to figure out how to allocate and free memory correctly when I'm using a linked list node (a pointer inside a struct). When I can get my code to run without error I am getting major ...
0
votes
1answer
718 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 ...
1
vote
2answers
1k views

how to check if just the load function is implemented correctly?

I've just started this pset and only implemented load. So how do I know if my load function actually loads the dictionary and there are words in the hashtable without implementing the other functions ...

1
18 19
20
21 22
24