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
22 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]) %...
user avatar
0 votes
1 answer
12 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; ...
user avatar
0 votes
1 answer
15 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 ...
user avatar
0 votes
1 answer
30 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 ...
user avatar
  • 1
0 votes
2 answers
13 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 ...
user avatar
0 votes
1 answer
46 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 ...
user avatar
0 votes
1 answer
23 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, ...
user avatar
  • 5
0 votes
1 answer
15 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> ...
user avatar
  • 3
0 votes
1 answer
25 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 ...
user avatar
0 votes
1 answer
30 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 ...
user avatar
0 votes
1 answer
25 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 ...
user avatar
  • 3
0 votes
1 answer
37 views

CS50 pset5 Speller: double free or corruption (fasttop) Aborted/ free(): double free detected in tcache 2

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; ...
user avatar
0 votes
0 answers
16 views

PSET 5 speller memory won't be freed despite using free()

It seems that my program, though it compiles and begins to run, seg faults due to a memory leak acording to valgrind: ==4602== HEAP SUMMARY: ==4602== in use at exit: 4,007,248 bytes in 71,558 ...
user avatar
  • 1
0 votes
1 answer
23 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 ...
user avatar
1 vote
1 answer
27 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 ...
user avatar
0 votes
1 answer
49 views

Speller segmentation fault

'''// Implements a dictionary's functionality #include <stdbool.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> #include "dictionary....
user avatar
0 votes
0 answers
14 views

lab5 memory leakage - Why is the function not working even using calloc?

Tried many iterations and even changed the allocation to calloc() that i read it frees memory used by NULL or undefined data and still get the same error. in create_family(int_generations) // TODO: ...
user avatar
0 votes
0 answers
18 views

Timed Out in Check50 Pset5/Speller

Please help, have Checked and debugged the program and couldn't find the issue. Have moved the debug to only include individual functions and checked again but still couldn't find the issue. The ...
user avatar
0 votes
0 answers
36 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
  • 5
0 votes
0 answers
181 views

Why it shows "free(): double free detected in tcache 2" in speller?

I am working on pset5 and speller assignment. Here is my code: // Implements a dictionary's functionality #include <stdbool.h> #include <string.h> #include <strings.h> #include &...
user avatar
0 votes
1 answer
16 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:
user avatar
0 votes
1 answer
37 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 ...
user avatar
  • 5
0 votes
1 answer
34 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 != ...
user avatar
0 votes
1 answer
16 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 ...
user avatar
0 votes
1 answer
26 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 // ...
user avatar
  • 7
0 votes
1 answer
41 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: // ...
user avatar
0 votes
0 answers
17 views

Pset5 - Segmentation Fault (solved)

SOLVED. Hi all: Could I please get some help interpreting Valgrind's output for pset5? Disclaimer: I think my code (far bottom of post) itself is wrong, but want to fix the segmentation fault first. ...
user avatar
0 votes
1 answer
64 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 ...
user avatar
0 votes
0 answers
31 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. // ...
user avatar
0 votes
1 answer
21 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 ...
user avatar
0 votes
1 answer
40 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:...
user avatar
0 votes
1 answer
7k 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 #...
user avatar
0 votes
1 answer
34 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(&...
user avatar
0 votes
1 answer
36 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 ...
user avatar
0 votes
1 answer
45 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 ...
user avatar
0 votes
0 answers
23 views

Need help with check function, speller problem

When the program reaches this line of code: if (strcasecmp(seguido->word, word) == 0). It does nothing, it doesn't have an output or continues to the next iteration. Here are all the functions of ...
user avatar
1 vote
1 answer
54 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> #...
user avatar
0 votes
1 answer
37 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 ...
user avatar
0 votes
1 answer
47 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 ...
user avatar
0 votes
1 answer
33 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 ...
user avatar
  • 42
0 votes
1 answer
30 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 ...
user avatar
0 votes
2 answers
24 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 ...
user avatar
  • 14
0 votes
1 answer
39 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> #...
user avatar
0 votes
1 answer
47 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> ...
user avatar
0 votes
1 answer
55 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'...
user avatar
0 votes
0 answers
27 views

CS50 Speller: valgrind test says that bytes are still reachable in 3 blocks

I'm currently at the CS50's pset5, and am working on the "Speller" problem. I managed to do all functions and don't have any compile or runtime errors. When using check50, though, I receive ...
user avatar
0 votes
0 answers
182 views

pset5 ; inheritance ; memory leakage

I have successfully completed the inheritance.c script, but there is something I do not understand, if anyone would be willing to help. inside free_family function, when handling the base case: if (p-&...
user avatar
  • 3
0 votes
0 answers
25 views

My program is showing Segmentation Fault

I am working on pset5 speller. When I am running my program it is showing segmentation fault. And I am not quite sure why. Please look into it. here is my code: // Implements a dictionary's ...
user avatar
0 votes
1 answer
60 views

Where am I making a mistake?

I am solving problem set5, speller. My program is compiling correctly, but I am not sure exactly what the output is supposed to be. My program is not even getting approved from the check50. Here is ...
user avatar
0 votes
1 answer
33 views

pset5 speller all words are spelled wrong

new error: most words are seen as spelling error Here's my full code: (UPDATED) // Implements a dictionary's functionality #include <stdbool.h> #include <string.h> #include <stdio.h>...
user avatar

1
2 3 4 5
25