Skip to main content

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

CS50 PSET 5: Returning 0 words in large dictionaries only

I've been trying to figure this out for a while now. I'm doing PSET 5 and all my dictionary words in large texts return 0, though when I've tried the small dictionary, it returns the words fine there. ...
figuringitout101's user avatar
0 votes
1 answer
117 views

Pset5 speller memory leak (valgrind: definitely lost)

There is a memory leak problem with my code when I ran it with valgrind.I have already check my code and passed all of them except for memory test.I am hoping someone can help me solve this problem....
mad_oreo's user avatar
0 votes
1 answer
39 views

segmentation fault from pointers

i keep getting segmentation fault when running this code. using printf i can see its from loading ala and the hashtable to store this is set to nil. other words when the hashtable to store them is nil ...
yosef's user avatar
  • 5
0 votes
1 answer
138 views

Speller works for everything but one letter words

When I run my speller program it works on everything but one letter words. I have been trying to figure this problem for a long time. I think it is a problem with either my hash or check functions. ...
Ajy_Chikn's user avatar
0 votes
0 answers
129 views

Pset5 Speller Memory Problem

I am having a memory issue with my program in speller. Check50 returns all green except for the last line which says :( program is free of memory errors expected "MISSPELLED WOR...", not &...
sage7major16's user avatar
0 votes
1 answer
51 views

Speller outputs all words as misspelled

I currently am doing the Week 5 Speller project. My code outputs all words as misspelled. I think it has to do with the load() function, but I am not sure if or why it is doing that. I don't think ...
Yash-902's user avatar
0 votes
1 answer
42 views

segmentation fault with node pointers on speller

I know which line has the segmentation fault , if (table[hashn]->next == NULL) In this case hashn is 0 so its not exceeding the array Any ideas why its happening?
Leo8479500282664829200's user avatar
0 votes
1 answer
74 views

PSET5: Problem with my check function, but I'm not sure

I have been stuck with this problem for many hours now, but I still can't wrap the idea around my head. When I test run this code, it just prints out "MISSPELLED WORDS", and nothing more. ...
amadeus445's user avatar
0 votes
1 answer
85 views

PSET5 - SPELLER - Check50 only works locally

I am trying to run check50 on my version of speller. I worked for so long on this code. It was a battle every step of the way to get it to finally run. I finally seemingly got it today. My code works ...
ruscias's user avatar
0 votes
1 answer
21 views

pset5 speller different unload algorithms

I just finished pset5 but I had a question about why a (what i think is) recursive method doesnt work but the one i went with does. if you skip and look in unload youll see a "destroy" ...
JuneDev's user avatar
0 votes
1 answer
162 views

Compilation Error

I tried to compile Dictionary.c[Problem set 5] and it appears an error which is : /usr/bin/ld: /lib/x86_64-linux-gnu/Scrt1.o: in function _start': (.text+0x1b): undefined reference to main' clang: ...
George ZaKhary's user avatar
0 votes
4 answers
363 views

PSET5 Speller: Check50 Can't Compile: Exit code 2 vs 0

At my wit's end here. I've seen this question asked before, but I haven't really found an answer. My speller program compiles perfectly fine in the VS Code workspace. It generates the same results as ...
Steedy Speve's user avatar
0 votes
1 answer
60 views

PSET5 - 3 conceptual questions (debug not needed)

Question 1 (hash) – is it even remotely possible to reverse engineer the hash function when given lots of output? For example if the underlying hash function is something simple like tolower(word[0]) %...
Vincent Xu's user avatar
0 votes
1 answer
38 views

PSET5 unload error

bool unload(void) { // TODO int i = 0; for (i = 0; i < N; i++) { node *cursor = table[i]; if (cursor != NULL) { node *tmp = cursor; ...
Vincent Xu's user avatar
0 votes
1 answer
2k views

CS50 Pset5 Help

it's my first time on here after a long time of following conversations and seeking help. In Pset5 Speller (CS50 2022), I have a weird situation. My code for dictionary.c works when I use the basic ...
matsterdam's user avatar
1 vote
3 answers
6k views

I hope CS50 community can help why I got expected exit code 0, not 1

If I "return None" explicitly for exceptions in a regular .py file, when I do the test.py file, is it correct to test with a "assert function(argument) is None?" I did a pytest and ...
TimL's user avatar
  • 11
0 votes
2 answers
32 views

Speller returning 'a' or 'A' as misspelled 500+ times

I successfully managed to make the code compile and removed all segmentation faults, but now it returns the problem as described in the title. I assume the problem is in load, as it appears to not be ...
ryanjbr's user avatar
1 vote
1 answer
5k views

PS5 - Back to the Bank - check50 - expected exit code 0, not 1

For PS5 - Back to the Bank, the unit test script works when I run it on code50, however, when I run the check50 I am getting expected exit code 0, not 1. If anyone has a suggestion, I would greatly ...
Jean-Marc's user avatar
0 votes
2 answers
408 views

speller seg fault

I have been on this for literal days, there is always a seg fault no matter what i do things i have tried: debug 50: MULTIPLE TIMES, i fix the errors i find but end up with another one soon after, ...
jeddah's user avatar
  • 5
0 votes
1 answer
31 views

I write all the function but the actual misspelled words are much greater than the expected misspelled value, not working well with substrings

// Implements a dictionary's functionality #include <ctype.h> #include <stdbool.h> #include <stdio.h> #include <strings.h> #include <stdlib.h> #include <string.h> ...
Nebiyu's user avatar
  • 3
0 votes
1 answer
61 views

PSet5 - Dictionary loading only one word

I've been banging my head for the last few hours as to why my dictionary function only saves one word from the whole dictionary. Even though debug50 and printf shows different hashes for different ...
javabeginner258's user avatar
0 votes
1 answer
58 views

Speller - My code keeps failing and I have no idea why

Running my dictionary.c code against the sample text with ./speller texts/lalaland.txt shows that I have the same number of misspelled words as the staff's solution, but for some reason I only have 1 ...
Jason Chu's user avatar
  • 103
0 votes
1 answer
72 views

PSET 5 Speller - can't make load function work

I can't pass load stage and I can't check other functions as I can't seem to load the words to the hash table. I tried to see where is the issue and found out fscanf function(?) doesn't seem like ...
armn's user avatar
  • 3
0 votes
1 answer
159 views

CS50 pset5 Speller: double free or corruption

I get double free or corruption (fasttop)\n Aborted when I run my code. Somehow, only small dictionary can handle up to around 50 words perfectly but sometimes it can only handle 10 words; other than ...
mossburger55's user avatar
0 votes
1 answer
115 views

Speller: Valgrind Still Reachable Error

after scouring the internet for multiple solutions to my Valgrind issue I cannot seem to find any that is specific to my code. I've spent hours coding this and Check50 gave me the green light except ...
Jun_MacJun's user avatar
1 vote
1 answer
79 views

Problems with Speller: Unable to Load Dictionary

Whenever I try to run my speller program, it says that it is unable to load the dictionaries (both small and large). Even when I try using someone else's code on the internet, which is supposed to be ...
Knowledged's user avatar
0 votes
0 answers
69 views

Speller: Load function only reads 9 words to memory

I finished coding all functions for the pset5. However, all my tests result in the same output: Words in Dictionary: 9 It does not matter which texts I am running. But, I cannot find my fault in the ...
user avatar
0 votes
1 answer
24 views

Clang error when compiling (Pset 5)

I tried googling this but I couldn't find (or understand) much. I'm receiving the following error when I go to make dictionary: Here is my code for the load portion:
hawki2sl's user avatar
0 votes
1 answer
120 views

Pset 5 speller: segmentation fault for large dictionary

I can't figure out what I am doing wrong, have gone through many questions and walkthroughs of this problem and it still looks like it should be correct. It obviously is not! With a small and medium ...
пaean's user avatar
  • 5
0 votes
1 answer
48 views

I just can't figure out how to put the word into lowercase for the hash function to provide the same index

bool check(const char *word) { char mot2[46]; for (int o = 0, h = strlen(word); o < h + 1; o++) { mot2[o] = tolower(word[o]); } int y = hash(word); node *cursor = table[y]; while (cursor != ...
Pahilajani Palak's user avatar
0 votes
1 answer
24 views

pset 5 Speller - Mispelled Words Issues

Running the program, a large portion of text is incorrectly flagged as mis-spelled. I've reviewed & changed the hash / check / load functions but I end up with the same issue. Can someone point me ...
Kenny Sun's user avatar
0 votes
1 answer
32 views

I have no idea why my speller in pset5 is giving the wrong amount of misspelled words

I am not sure where my mistake is, I keep getting too many misspelled words. This is the link to check 50 I run on the code: https://submit.cs50.io/check50/ce552ed87b7d99ac966d9ba7a897bda34bf0a794 // ...
Dylan's user avatar
  • 7
0 votes
1 answer
994 views

Program is free of memory errors, valgrind tests failed - pset5 speller

I'm am getting this error - program is free of memory errors, valgrind tests failed; see log for more information. I have tried so many things but I keep getting more errors. Here is my code: // ...
aw_codes's user avatar
1 vote
1 answer
415 views

Pset5 speller load

I am having an issue with my load function in pset5 speller, I really can't tell what's going on. I've gone back and rewatched the lectures and have redone my code a few times but just can't figure it ...
Michael Puckett's user avatar
0 votes
0 answers
45 views

Pset5 speller memory still reachable

I am having a lot of issues with memory being still reachable. I've used help50 and valgrind but can't quite understand what I have going on so I'm just going to post my whole code I have. // ...
Michael Puckett's user avatar
0 votes
1 answer
69 views

pset5 speller Hash table not appearing in the debug50 stack/heap

This question is related with this other question of mine, in which I am trying to complete pset5: speller. I took Cliff's advice, and additionally executed the debug50 on my code. Since the original ...
nico_so's user avatar
0 votes
1 answer
72 views

pset5 speller memory errors with valgrind

i've been working in pset5 and cannot make it work. I've read some similar questions and made some improvements to my code, but still can't figure what is wrong. Any tips are welcomed! Here is my code:...
nico_so's user avatar
2 votes
1 answer
34k views

PSET5 compiles but gives: "free(): double free detected in tcache 2" error on testing

Been scratching my head at this for a while now. I use FREE() only once in the program, and don't know why I get this error. Any help is appreciated :-) // Implements a dictionary's functionality #...
General Noob's user avatar
0 votes
1 answer
57 views

PSET5 Why Speller can't load dictionary? (included HASH function in case it's relevant)

// Load function bool load(const char *dictionary) { char word[LENGTH + 1]; FILE *file = fopen("dictionary", "r"); if (file == NULL) { printf(&...
General Noob's user avatar
0 votes
1 answer
221 views

Speller not handling substrings properly

All tests seem to pass okay apart from the substrings test.The results of this test are : :( handles substrings properly expected "MISSPELLED WOR...", not "MISSPELLED WOR..." Log ...
shedfur's user avatar
0 votes
1 answer
59 views

Help with check function (PSET5)

My check function is counting the right amount of words in dictionary and text, but it outputs words that are not misspelled. Here are all the functions of the problem, the arrays are used to locate ...
Isabel García's user avatar
1 vote
1 answer
99 views

Pset 5, Speller, What are the issues in my code(Check or load issues?)?

// Implements a dictionary's functionality #include <stdbool.h> #include <stdio.h> #include <string.h> #include<strings.h> #include<stdlib.h> #include <ctype.h> #...
VooDooDarkMagic's user avatar
0 votes
1 answer
40 views

Speller still isn't running correctly

I rectified the earlier error in my code (putting dictionary within inverted commas). I also corrected my error in unload where the function would always return false instead of true. However, I ...
Hamster1303's user avatar
0 votes
1 answer
218 views

pset5 - speller "double free detected" when I run check 50 but program does nothing during self tests

I am currently doing Speller. I have written all the functions and the program compiles but during self testing it is printing "misspelled words" and stays stuck at a blinking cursor. It ...
Dre Johnson's user avatar
0 votes
1 answer
39 views

pset5 unload + valgrind

I tried to solve problem with memory usage but did not figure out where is the problem. Dictionary unloads successfully but still issue with memory access exists. I think that problem with ...
LeVl's user avatar
  • 42
0 votes
1 answer
48 views

Getting a segmentation fault on cs50's speller (pset5)

I would love a bit of help on cs50's pset5 speller. The program does compile. However, when I run valgrind ./speller texts/cat.txt I get a segmentation fault . I think I am overlooking something but I ...
Hamster1303's user avatar
0 votes
2 answers
39 views

Pset5 CHECK cursor returns NULL erroneously

I keep getting most, if not all, of the words in the text returned as misspelled. I tried debug50 with the small dictionary and cat text and found that the cursor in CHECK always returned NULL, so the ...
Lperino's user avatar
  • 14
0 votes
1 answer
176 views

problems in unload function-pset5

// Implements a dictionary's functionality #include <strings.h> #include <stdlib.h> #include <ctype.h> #include <stdio.h> #include <stdbool.h> #include <string.h> #...
Pragati Chauhan's user avatar
0 votes
1 answer
58 views

dictionary.c - pset5 segmentation fault

// Implements a dictionary`'s functionality #include <strings.h> #include <stdlib.h> #include <ctype.h> #include <stdio.h> #include <stdbool.h> #include <string.h> ...
Pragati Chauhan's user avatar
0 votes
1 answer
114 views

Problem Set 5 - Segmentation Fault

I am trying to overcome the segmentation fault on the following code, and I couldn't manage to solve the error. Segmentation fault occurs in the load() function, and after hours of debugging, I couldn'...
DarthVader's user avatar

1
2
3 4 5
26