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.
1,285
questions
0
votes
1
answer
14
views
In pset5 speller : Two variants of same code differ in case sensitivity
//This is case insensitive as it should be
unsigned int hash(const char *word)
{
// TODO: Improve this hash function
if ((strlen(word)) <4 )
{
return (tolower(word[0]) - 'a');
...
0
votes
1
answer
16
views
PSET5 - SPELLER - CODE COMPILES BUT FAILS CHECK50
// Implements a dictionary's functionality
#include <ctype.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#...
1
vote
1
answer
18
views
Unable to free up the malloc space, don't know what's going wrong in speller?
// Implements a dictionary's functionality
#include <ctype.h>
#include <stdbool.h>
#include <string.h>
#include <strings.h>
#include <stdio.h>
#include <stdlib.h>
...
0
votes
1
answer
20
views
pset5 speller - check functions seems to only return false?
so, it seems like the check() function returns false no matter what. when running debug50 it seems the cursor pointer only points at NULL, and i have no idea why and how to fix it.
additionally, ...
0
votes
1
answer
32
views
PSET 5 Test plates : getting exit code 0 instead of 1
test_plates:
from plates import is_valid
def test_correct():
assert (is_valid("ASD123")) == True
assert (is_valid("ASD")) == True
assert (is_valid("AS2")) == ...
0
votes
1
answer
20
views
Speller valgrind test failing
I am working on the speller problem, I got every test except for valgrind to pass.
Here is the valgrind error:
running valgrind --show-leak-kinds=all --xml=yes --xml-file=/tmp/tmpbhs1m7v4 -- ./speller ...
-1
votes
2
answers
27
views
Programme fails on freeing memory - Pset 5 (speller)
I have functioning code for Speller (problem set 5), but check50 reports a memory leak from the line table[i] = n;
Compilation fails when trying to free the node in the unload function:
bool unload(...
0
votes
2
answers
47
views
PSET 5 - Speller: Compiles locally, check50 says it doesn't
I know this is one of the most frequently asked questions here, since I' ve spent more than an hour reading posts by people that faced similar problems. But still, I can't tell what's going on in my ...
0
votes
0
answers
37
views
problem with speller problem set 5 code
well i have a problem with speller problem set 5 code. For some reason check50 returns everything wrong but when i debug it seems fine. I don't really know what the problem with my code is. This is my ...
0
votes
1
answer
15
views
pset5 - seg fault when using large dictionaries or texts
I've been stuck on speller for a few days now, and recently I've gotten the program to completely pass check50. However, when I try to run it manually on my own, I find that the program works fine ...
1
vote
1
answer
19
views
Get a MISSPELLED WORD memory error from check50 PSET5
I've gone through other threads but can't find what the problem is. I don't see any errors when I run valgrind but when running check50 for PSET5 get the following error:
Cause
Did not find "...
0
votes
1
answer
70
views
"test_fuel catches fuel.py not printing % in gauge expected exit code 1, not 0"
I have passed all of the other check50 requirements except for this one.
Here is my code
def main():
while True:
try:
number = input("Fraction: ")
if &...
1
vote
2
answers
32
views
PSET 5 speller fails when solving a memory issue
Ok so when I compile the commented out part, check50 fails most of my criteria! But if I remove it, the program works but Valgrind has a frown. But when i run valgrind without the commented code, it ...
0
votes
1
answer
20
views
PSET 5 speller segmentation fault when trying to run
Code compiles, but when I try to run it there's a segmentation fault. Aaand I got all frowns on check50.
#include <ctype.h>
#include <stdbool.h>
#include <stdint.h>
#include <...
0
votes
0
answers
33
views
test_fuel.py failing at "all test_fuel checks, expected exit code 0, not 1"
All test are going through and program itself seems to be working correctly returning ints, strs and printing only in main() but still doesnt seems to pass the checks, can't see what could cause it.
...
-1
votes
1
answer
142
views
DON'T KNOW HOW TO HANDLE THIS CHECK50 ERROR MESSAGE WITH test_plates.py
I'm dealing with Units Test and Problem set 5 test_plates.py/plates.py. I get this msg:
My function is_valid(s) checks this at very beginning. I have not idea about what i'm not dealing or handling ...
1
vote
1
answer
47
views
pset 5 speller do not pass check 50
I do not know what I am doing wrong. Please, give me a hint.
Here is my solution from check50:
:( spell-checking is case-insensitive
Cause
expected "MISSPELLED WOR...", not "MISSPELLED ...
1
vote
1
answer
62
views
pset5 speller cannot read number of word in dictionary
thank you for clicking. Being concise, I have the right solution for the pset, as evidenced down below by comparing my solution to the staff's, but check50 insists that no words have been loaded into ...
0
votes
1
answer
30
views
Pset5 Speller - Weird Load Function Bug (Edited w/ Code)
bool load(const char *dictionary)
{
// TODO
FILE *fdict = fopen(dictionary, "r");
if (fdict == NULL)
{
return false;
}
// create container string to hold ...
0
votes
1
answer
197
views
Refueling - problem set 5 - CS50
I have a problem with refueling from problem set 5 of cs50p. I tried and implement a lot of version of the code, always good enough to do the job and pass the test but check50 fails. I give fuel.py ...
0
votes
1
answer
19
views
Code for pset5 compiles, but produces no OUTPUT. Seems like it is stuck in infinite loop
Description of Problem:
Hey guys, so my code is outputting only MISSPELLED WORDS and then it apparently gets stuck in an infinite loop. So that I have to type ctrl + C to be able to type anything in ...
0
votes
1
answer
34
views
Speller works fine up until a certain point
My speller program has an issue where it will find what words are misspelled properly, but it won't give the data of the amount of words misspelled/ in the dictionary/ in text. Running Check50 shows ...
0
votes
1
answer
54
views
Speller Segmentation Fault Even After Freeing Malloc'd Nodes
The following is my code and, subsequently, the message Valgrind returns when I run it on ./speller texts/lalaland.txt.
I explored similar issues previously posted on Stack exchange, and added lines ...
0
votes
1
answer
58
views
CS50 Speller works but check50 doesn't
My code seems to work fine with all text files.
When I look at the errors it doesn't even show actual output, why could that be?
https://submit.cs50.io/check50/e963f4484de14f0b73f8fca9a5e9431556cb649a
...
0
votes
1
answer
75
views
PSet5 Speller: Are we hashing the words in the dictionary into a hash table or the words of the text?
I've completed the first function of the Problem set, where I've sorted every word in the dictionary into a trie, but I don't know if I was supposed to do that in the hash function, and something else ...
0
votes
1
answer
17
views
PSet5 Speller: What is each function in dictionary.c supposed to do? [closed]
I've started working on this PSet, and now I'm confused because in the instructions I can't figure out where it tells me what each function is supposed to do. Hash is never even called in speller.c so ...
0
votes
1
answer
35
views
Speller: memory leak
This is my program:
// Implements a dictionary's functionality
#include <ctype.h>
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#...
0
votes
0
answers
23
views
Need help with speller.c
So, when I was testing my code for pset5's speller, I ran it and it worked not so well, to be honest, heres my code if you wanna know:
#include <ctype.h>
#include <stdbool.h>
#include <...
0
votes
1
answer
23
views
pset5 segmentation faoult
Good morning, I have segmentation fault on my dictionary.c code, I was trying to find a Typ0 mistake or variable declaration mistake but I can not find anyone. Also I can not find logic errors, so I ...
0
votes
1
answer
57
views
Everything is correct in my Check50 but in program I have other ERRORS - PSET05 Speller
I hope you're doing well and I also hope you might help me. When I run my CHECK50 in my speller program. Everything is correct all green, but when I run my program or valgrind I have some errors. And ...
0
votes
1
answer
35
views
Pset5 speller segmentation fault when loading
When I run speller, I get a segmentation fault. I have played around with the code a little bit and nothing so far has changed. Using help50, this is the result I got:
Looks like you're trying to ...
0
votes
1
answer
53
views
PSET 5 "SPELLER" : Why this hash function resulting in SEGMENTATION FAULT(core dump)?
If i run it in another smaller program it works fine( returns the key correct) but on the pset 5 speller it gives segmentation fault. why?
1
vote
1
answer
2k
views
check50 error expected exit code 0, not 1
I was following python programming course and with the unit test chapter I updated the main file and the test files as described in this problem set page. Now I'm sure that my tests are running fine ...
0
votes
1
answer
115
views
pset5: Check50 fails for Speller but everything looks good
I wrote dictionary.c.
It compiles.
There are no issues with valgrind.
It appears to run correctly (when comparing with answer keys).
Everything looks good.
But when I run Check50, it runs into issues ...
0
votes
1
answer
47
views
pset5 speller valgrind test fails
in check50 my code fails last test (valgrind test) fails it says:
"Use of uninitialised value of size 8: (file: dictionary.c, line: 41)"
i starred line 41 below,
I tried both using if(!...
0
votes
1
answer
2k
views
correct plates.py passes all test_plates checks: expected exit code 0, not 2
On pset 5, I am getting this error from check50:
:( correct plates.py passes all test_plates checks
expected exit code 0, not 2
I am confused because my plates.py does pass all test_plates checks:...
0
votes
1
answer
45
views
PSET5 Speller case conversions
I've been struggling with writing code for case conversions in the check function to make all hash words to be lower-cased. My lack of knowledge in programming overall seems to be revealed at this ...
0
votes
0
answers
32
views
(pset5)I get a segmentation foult, even though check50 says that everything is allright
as per the title — I get a segfoult and can't check my times, even though check50 claims that the code is practically ready to submit.
Here's my code, followed by valgrind results:
// Implements a ...
0
votes
1
answer
177
views
Pset5 Speller - Valgrind issue
this one was tough. But in the end my code compiles fine and has no memory leaks, the hash function isn't very good but it works. Yet I still get an error message that I just don't understand. First, ...
0
votes
1
answer
67
views
Pset5 speller memory error --valgrind says no leaks
I almost finished pset 5 speller, I ran check50 and only the last criteria was not matched.
That is "valgrind tests failed; see log for more information."
The confusing thing is, when I ran ...
0
votes
1
answer
30
views
PSET5 Speller seg fault
I keep having segmentation fault in Pset5 Speller.
I used debugger to find the line where seg fault happens,
and it was "table[k] = n;" in function load.
I don't really understand. Could ...
0
votes
0
answers
41
views
I'm working on pset5 - speller, it works fine when I run/test it, but when I run 'check50' it show this error. help me with this
[EDIT: Code removed for Harvard Honor Code compliance.]
0
votes
2
answers
215
views
Valgrind error in pset5 speller
newbie here this is my first post, I hope you guys can help me! I am stacked with speller, my program works apparently fine but the valgrind test outputs some errors that I can't understand. I have ...
0
votes
1
answer
53
views
pset5 speller load and hash functions
Whenever I run speller.c it appears that none of the words are getting loaded into the dictionary as the output looks like this:
MISSPELLED WORDS
A
cat
is
not
a
caterpillar
WORDS MISSPELLED: 6
...
0
votes
2
answers
166
views
PSET 5 Speller Check50 Problem
I think I have done everything you're supposed to do in PSET5 Speller. when I manually check the outputs of my code, it works perfectly well. It matches the staff solutions one to one. Yet Check50 ...
0
votes
1
answer
38
views
PSET 5 Speller Valgrind Memory
My code is functional according to check50 but I'm still leaking bad memory. Based on amount of memory lost, I'm guessing something to close up in LOAD, but could be UNLOAD as well. First thoughts are ...
0
votes
1
answer
80
views
PSET5 - Speller - Valgrind returns memory leak
After many trials, I am currently stuck in this Pset. The full code that I have is as follows:
// Implements a dictionary's functionality
#include <ctype.h>
#include <stdbool.h>
#include &...
0
votes
1
answer
50
views
PS5 - Speller - Unload function
I have been going through the Pset5 (Speller) and I am currently stuck. Right now, I am just trying to have a functional code, so I am not worried about how optmized my functions (specially the Hash ...
0
votes
1
answer
40
views
pset 5 speller, turning frowns upside down
I thought i had wrote a correct programme for speller, check 50 says that my code compiles but that is all it does! I have been running my programme and combing through each function and I still can't ...
0
votes
1
answer
53
views
Pset5 Speller - Got "Conditional jump or move depends on uninitialised value(s)", "Use of uninitialised value of size 8" by check50
I try my code here to solve the pset5 - speller question, it seems pretty ok with locally run my valgrind. But when I use check50 to check it. One error(and only 1) happened.
I tried to assigned ...