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
112 views

cs50 Pset5 Valgrind Error

I'm just about to finish pset5 but I'm stumped on this valgrind error. Check50 tells me everything works well except that I am leaking memory. Valgrind tells me the memory leak is coming from line 44 ...
Nick's user avatar
  • 7
0 votes
1 answer
107 views

PSET5 Speller - Just totally lost, code compiles but all check50 tests fail

I've been beating my head against a wall on this pset for 10 days now, watched all the videos, solved all the compiler errors, and just when I felt like I kind of understood this thing I ran the test ...
Brandon Zemel's user avatar
0 votes
1 answer
850 views

speller works fine but can´t pass check 50

I've been working a few days in speller and I've managed to make it work exactly like the cs50 staff's (or at least it looks exactly) But check50 says everything is wrong except compiling: :) ...
Alejandro Sánchez's user avatar
0 votes
1 answer
548 views

CS50 Speller Load function

I looked through my load function with debug50 and realised that each time the loop is iterated, the pointer temp always gets assigned the same value despite freeing it, how do Igo about resolving ...
tangolin's user avatar
  • 104
0 votes
1 answer
357 views

Need help: pset5 "Speller"

I am having a strange issue with the pset5. When I debug the file, it works fine, but when I check it through Check50, it throws several frowns at me. Need suggestions. Here is my code: #include <...
noob_dev17's user avatar
0 votes
1 answer
109 views

almost there, but Valgrind reports an uninitialised value

Thanks in advance for helping out an old Dutchie! I am almost there, but valgrind insists i have an uninitialised value on in the While loop: while (cursor != NULL) VALGRIND tells me ==...
Maarten's user avatar
0 votes
1 answer
305 views

PSet5 case-insensitive using strcasecmp

Tried iteration over strlen and random constant variable but unable to solve: :( spell-checking is case-insensitive expected "MISSPELLED WOR...", not "MISSPELLED WOR..." Here is my full code: //...
Activity Uday's user avatar
0 votes
1 answer
106 views

pset5 speller load - check function it does compile but my words in dictionary output are not correct

the following function is my load - check functions. I believe one of two have the issue but not sure which one. Thanks for the help. My cs50 checks are like the following : WORDS MISSPELLED: ...
IDK's user avatar
  • 7
0 votes
1 answer
231 views

pset5 speller "Could not load dictionaries/large"

I cannot figure out what I am missing. Program keeps returning "Could not load dictionaries/large" I have checked and tried different suggestions from similar questions but I do have the folder ...
meh362's user avatar
  • 5
0 votes
1 answer
23 views

Pset5 Speller: Valgrind error with bool check

I solved every memory leak I had, but I'm having some issues with this one. What's a good method to free memory from node* checker in this case? bool check(const char *word) { node *checker = ...
Lautaro D. Futuro's user avatar
0 votes
1 answer
94 views

Valgrind shows memory error pset5

My code is // Implements a dictionary's functionality #include <stdbool.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <strings.h> #include <...
Vsjain's user avatar
  • 1,016
0 votes
2 answers
45 views

PSET5 - Valgrind error - no enough bytes are being freed

I've been on this pset for some time now and everythin seems to be working except that there are some memory leaks and I really can't understand why. I've checked a lot of other people's codes but I ...
sadprogrammer's user avatar
1 vote
0 answers
44 views

Speller doesn't answer correctly

my code is // Implements a dictionary's functionality #include <stdbool.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <strings.h> #include "...
Vsjain's user avatar
  • 1,016
0 votes
1 answer
70 views

Speller Load doesn't see certain words

My load function sometimes overlooks certain words in the dictionary. For example it jumps over the word "nodes" instead of loading it into the hash table. bool load(const char *dictionary) { // ...
Imperator10111's user avatar
0 votes
0 answers
445 views

Shows double free or corruption (fasttop)

// Implements a dictionary's functionality #include <stdbool.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include "dictionary.h" // Represents a node in a ...
Vsjain's user avatar
  • 1,016
1 vote
1 answer
400 views

pset5 Speller: No Correct Output

I have tried again and again different ideas but I simply can not get Speller to find the right misspelled words. I have no idea what I'm doing wrong. I keep changing things in various functions to ...
Bethany's user avatar
  • 25
0 votes
1 answer
2k views

Valgrind says no leaks possible. However has lots of errors

My code passes check50 apart from the memory leak section. Valgrind shows no leaks are possible but lots of errors: ==21401== HEAP SUMMARY: ==21401== in use at exit: 0 bytes in 0 blocks ==21401== ...
hh1265's user avatar
  • 3
0 votes
1 answer
47 views

Speller Works on all .txt files, but FAILS Check50

My Speller function works on all the .txt files provided with the keys. I even made a .txt containing the large dictionary and all the words are spelled correctly. However, when I go to use Check50 ...
camptzak's user avatar
0 votes
2 answers
173 views

Pset5 Memory leak in unload()

I've been working on speller for about two weeks now and I've finally got the programm to work, but valgrind cam up with a few memory errors. I've managed to solve most of them on my own, but the leak ...
Renée's user avatar
  • 19
0 votes
2 answers
110 views

Memory issue (Valgrind "Still reachable")

My code seems to pass all the Check50 tests except the one for memory as valgrind returns a "still reachable" error. Not sure what needs to be done, any help will be appreciated. Thanks! My Code #...
atr1's user avatar
  • 3
0 votes
1 answer
444 views

Valgrind uninitialized values pset5

This is my solution for pset5's speller problem, which uploads a dictionary with a hash table and checks an inputed text to find misspelled words. My code works fine when I run, but valgrind says "...
reillyderrick's user avatar
1 vote
1 answer
183 views

Speller (PSET5) has output that is exactly the same as the staff's solution, but check50 returns many errors. What's happening?

My speller program (part of pset5) works well and the output exactly matches that of the staff's solution. However, when I run my program through check50, I still get several errors per their script: ...
Santiago Pérez's user avatar
0 votes
1 answer
78 views

Pset5 Speller: Valgrind issue - conditional jump etc

I think I have my speller working except for the below issue. I can't see any variable's I have not initialized properly. Valgrind points to my check function (the offending line is marked below): /...
GFitzP's user avatar
  • 19
0 votes
1 answer
92 views

PSET5 check50 fail but same expected output from actual

I've seen a similar post about this but I couldn't really figure out why my code doesn't pass check50. It might be on the load function, but I'm not entirely sure. I already ran the code with the ...
Mars's user avatar
  • 3
0 votes
2 answers
330 views

pset5 speller almost all words are misspelled

I've looked through everyone with the same problem, the common answer seems to be lower-case issues in the hash function or freeing pointers before you are actually done using them. I have tried ...
HoopsLoops's user avatar
0 votes
1 answer
164 views

CS50 PSET5 Speller Valgrind error: still reachable: 8,013,096 bytes in 143,091 blocks

I have got this Valgrind error for my code. I know that I have not freed the malloc of new_node but I still could not solve this problem after trying many different ways. Can anyone help:( // ...
Marcus Chan's user avatar
0 votes
2 answers
1k views

cs50 pset5 speller check function too slow

When I run my speller program, everything compiles fine and the results are accurate, but the check function seems to be way too slow (takes ~7seconds) compared to staff's version(~0.2 seconds) and so ...
sonwy102's user avatar
0 votes
1 answer
63 views

Pset5 Valgrind Error: Reachable Memory

I've been on the speller problem for a while and I don't understand where i'm going wrong. Any help would be much appreciated. I'm getting the following error from valgrind when i run it alongside --...
Kalahari's user avatar
0 votes
2 answers
69 views

load function in speller not working properly not seem to figure out the correct way to link hastable?

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

Hello! I am stuck on pset5 speller

When I compile my code it gives correct results, but doesn't pass check 50. Could please anyone help me to find a mistake, thank you. #include <stdio.h> #include <stdlib.h> #include <...
Alisa Azimova's user avatar
0 votes
1 answer
84 views

Check function Segmentation

I am struggling to find the problem in my check function. I have a segmentation fault that it's position varies every time I alter my code a bit. bool check(const char *word) { int index = hash(...
Omar Zayed's user avatar
0 votes
0 answers
41 views

Cant figure out where im going wrong with unload and check

My check function, when unload had a bunch of leaked memory returned every word as incorrect. However, now I tried to fix my memory leak and im getting a double free error upon trying to run the ...
Garthy's user avatar
  • 1
0 votes
1 answer
241 views

i keep on getting segmentation fault in pset5

// Returns true if word is in dictionary else false bool check(const char *word) { //change letters to lowercase int length = strlen(word); char copy[length + 1]; for (int i = 0; i < length;...
richa sharma's user avatar
0 votes
1 answer
95 views

Getting a segmentation fault when i try to run pset5 speller and i'm not sure what's the problem. Appreciate it if someone can explain. thanks!

// Implements a dictionary's functionality #include <stdbool.h> #include "dictionary.h" #include <stdlib.h> #include <stdio.h> #include <string.h> #include <...
mufasasa's user avatar
0 votes
1 answer
209 views

Pset 5 Speller valgrind error

I am trying to fix the last error in my code pointed out by check 50. I think the problem is in my unload but can't say for sure. Here's my code. I know I have some basic functionalities wrong but ...
IrishBumfuzzle's user avatar
0 votes
1 answer
30 views

Pset5 Seg fault speller

I´ve been stuck in pset5 for a little while. I was wondering if someone would be able to take a loot at it? Fow now all my hash function does is look at the first letter of a word. I will of course ...
HumbleCauchyServant's user avatar
1 vote
1 answer
70 views

Pset5 Speller -- Conditional jump or move depends on uninitialised value(s); Uninitialised value was created by a stack allocation;

My code is able to pass all the tests in check50 except the valgrind one. Here is the error when I run the valgrind. Could someone help me, please? // Implements a dictionary's functionality #...
Shujie Zhang's user avatar
0 votes
1 answer
312 views

PSET 5 - Speller : Cannot handle apostrophes and sub-strings

I have problem making my code handle apostrophes and sub-strings. Been stuck on it for 3 hours now. I am using my own implementation of hash. Here is the code: // Implements a dictionary's ...
aNdroid's user avatar
0 votes
1 answer
32 views

Segmentation Fault in pset5 with the Table Variable

I have looked at this for hours. I am pretty sure the segmentation fault that I get when I try to run it is from line 82 to line 97. I only think this because load never successfully prints the ...
ntm52's user avatar
  • 5
0 votes
1 answer
285 views

CS50 pset5 program is free of memory errors valgrind tests failed;

I'm just minutes away from solving my problem in pset5. But I'm getting the following error from valgrind. ==12523== HEAP SUMMARY: ==12523== in use at exit: 0 bytes in 0 blocks ==12523== total ...
notrealecho's user avatar
0 votes
1 answer
34 views

PSET5 Unload() recursive sub-function causes 112 bytes to leak - why?

I've already fixed this issue playing around with my code, but I cannot seem to understand why this (former) version of my recursive function leaks 112 bytes (2 nodes). Can anyone please help me ...
user28178's user avatar
0 votes
1 answer
55 views

SEGFAULT in pset5 speller

I'm working on pset5 2020 speller. I have managed to get my code to compile but no matter how small the input data sets are I suffer a segmentation fault. I've run valgrind and there only seems to be ...
Renée's user avatar
  • 19
0 votes
1 answer
62 views

CS50 Pset 5 speller valgrind error

I am currently trying to master speller but getting an error in one specific line when I run valgrind. It mentions this line: n ->next = table[index]; I have no idea why. It says invalid read of ...
Liselotte Girke's user avatar
0 votes
1 answer
201 views

SPELLER(pset5), output of misspelled words is more than actual

There are two problems with the code: WORDS MISSPELLED are around five time normal. It is showing 5440 misspelled words while ideally there are around 900 such words(staff's solution). In the bool ...
noob_dev17's user avatar
0 votes
1 answer
116 views

CHECK50 ERRORS IN SPELLER PSET

Here is my code for the pset I am getting 2 errors after check50. I am not able to get hold of any loopholes in the code. Kindly help! 1) :( handles max length (45-char) words expected "MISSPELLED ...
Divij Jain's user avatar
0 votes
2 answers
81 views

CS50 Speller questions about how to move forward

I have a few questions about speller, both about how the program operates and how I should begin the start debugging and testing a program of this complexity. My first question involves why you only ...
michael's user avatar
  • 11
0 votes
1 answer
49 views

speller giving error on valgrind, using 4 bytes of memory that isn't yours...indexing an array out of bounds

I think the problem with is the load() function, here is my code: bool load(const char *dictionary) { char *s = malloc(LENGTH + 1); FILE *f = fopen(dictionary, "r"); if (f == NULL) { return false;...
Musical_Ant's user avatar
0 votes
1 answer
229 views

PSET5 - Speller - Doesn't display anything past MISSPELLED WORDS

I've been debugging for quite a while now and can't seem to figure out the solution to this problem. When I use the large or small dictionary on any of the texts, the program becomes stuck at ...
Trifex's user avatar
  • 3
1 vote
2 answers
7k views

PSET5 Speller hash function

I have been working on the speller problem in pset5 for a while now, and I am not able to figure out the problem in my hash function: unsigned int hash(const char* word) { int M = 1000000001; ...
Shrey Tripathi's user avatar
0 votes
1 answer
90 views

Speller - Program has memory errors, but Valgrind claims all heap blocks were freed

:( program is free of memory errors | pset5 Speller I have invalid reads at lines 148 and 153 of my code (commented out below): bool unload(void) { // CS50 for (int i = 0; i < 26; i++)...
vieveee's user avatar

1
4 5
6
7 8
26