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.
253
questions with no upvoted or accepted answers
1
vote
0answers
43 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 "...
1
vote
1answer
87 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:
...
1
vote
1answer
45 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
#...
1
vote
1answer
257 views
My check function in speller isn't working
I have implemented everything else but this check function when I try to test it it seems like the the check function isn't working, because the no. of misspelled words is the same as the no. in text.....
1
vote
0answers
94 views
1
vote
1answer
193 views
pset5 cs50 does not handle basic words properly
Can you please help with the following issue with speller from pset5 in cs50:
When I run the cs50 check, I get that it does not handle basic words properly, I am guessing, my check function is not ...
1
vote
1answer
394 views
Help with PSet 5 Load Function
I hope you are well. I am currently on pset 5 where you have to write a spell checker. I am stuck on the load function.
I am able to get stuff into my linked list. when I make and run it, I get a ...
1
vote
0answers
256 views
Pset5: questions about malloc() and calloc()
One clip of my code:
#include <stdbool.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <stdio.h>
#include "dictionary.h"
// Define a struct ...
1
vote
1answer
62 views
Using gdb for load function in speller
I am trying to figure out if all my words of the dictionary are uploaded in my declared node* hashtable[100]but when I am using gdb its just giving me the hexadecimal address of the nodes, be it a ...
1
vote
0answers
134 views
Problem in pset5 load
I've been stuck on pset5 load for a while now (like 1 month...) and I've advanced quite a lot but I'm so close to completing it but, unfortunately, I've reached a bit of a dead end when it comes to ...
1
vote
1answer
528 views
Pset5 Speller load() function completely stuck (trie)
I am completely stuck on pset5 load() function, have no idea where to go. Can someone please guide me in the right direction? Here is my code:
bool load(const char* dictionary) {
// TODO
FILE* file = ...
1
vote
1answer
113 views
pset5 says “Killed” when run
My dictionary/speller compiles, but stops with just a 'Killed' error message when run. I've tried putting a 'return 1' as the first line in speller's main(), but it still fails with the same message. ...
1
vote
1answer
225 views
PSET5 How can I test my code with small dictionary?
I'm trying to test my implementations of LOAD and CHECK with small dictionary of cs50 appliance, but it's look like I do the wrong thing... Someone can help me with that please! Thanks
jharvard@...
1
vote
1answer
433 views
PSET5 How can CHECK have access to the loaded dictionary?
I'm now working on the implementation of CHECK subfunction. I think I'm on the good way, but my major problem at this moment is to link CHECK with the loaded dictionary. I'm pretty sure I can't access ...
1
vote
0answers
209 views
pset5: Resize does not consistently work
I am having a problem with resize. I can resize smiley.bmp perfectly at X1, X2, and X10, but not for factors between 2 and 10--I just get an abstract blob of colors. I assume this has something to do ...
1
vote
3answers
421 views
pset5 resize working (IMO) but check50 says it's not
I'm having a bit of an issue here.. I wrote the resize.c function for pset5 and it is working - I am getting the expected results - I can see my file being resized and it looks alright in image ...
1
vote
1answer
190 views
Resizing small.bmp with n=4 gives an image with a black rectangle on the bottom left corner
When I try my resize program on small.bmp and enter 4 as n, it gives me a 12x12 picture that is all green, but instead of having the white little square in the middle it has a black rectangle on the ...
1
vote
1answer
510 views
adding padding into resize
I know my paddingOld & paddingNew values are correct.
I also know all my header info is correct (checked student vs staff)
check 50 passes the cases that do not need padding, but fails the ones ...
1
vote
1answer
375 views
pset 5 resize.cdoes not resize properly. works visually for smiley.bmp but not for small.bmp
Theses are my observations so far:
It can resize the smiley.bmp properly without distorting the image. What I'm not sure about is whether or not the contents of its headers are right.
It can resize ...
1
vote
1answer
168 views
PSET5 Spell Check: strncmp strcmp problems
1) The rules state I can't change speller.c
2) Speller.c sends each word to the check function in dictionary.c
3) I am creating a copy of that word in my function and making it all lower-case
4) ...
0
votes
1answer
20 views
Pset5 - Speller - Valgrind error for malloc in load function
I get all test results correct except the Valgrind error as follows, does anyone know why is it so and share some insights please? thanks!
running valgrind --show-leak-kinds=all --xml=yes --xml-file=/...
0
votes
1answer
18 views
speller returning a segmentation fault, unclear why
this is my dictionary.c implementation. I think the problem is speller since I've been printing my hash values from hash. I also have not yet implemented unload since I think I'm having some ...
0
votes
1answer
20 views
cs50 pset5 functions check load assistance required
I have reached an impasse with regards to this exercise.
I believe that I have written the load function and it works.
I also believe that the hash function works
I think the size function returns a ...
0
votes
1answer
35 views
(Speller) Search Function returns each word given as false, And when i run Small Dictionary gives me Segmentation Fault
// Implements a dictionary's functionality
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <ctype.h>
#...
0
votes
1answer
37 views
Struggling with PSET5 Speller valgrind problems (& possibly more)
I've been working on PSET5 for weeks now on & off and I'm becoming really frustrated. I think I'm lacking some understanding of the malloc/free relationship, I'm not sure. Here's all of my code. ...
0
votes
0answers
18 views
trouble loading dictionary
my load function seems to only load two words and all words are coming back misspelled. I don't know if the problem is with my load function or the hash function. I've gone over the load function ...
0
votes
1answer
15 views
My load function is licking memory
the program complies properly but when i use valgrind shows am leaking memory when I open the file in the FILE *file = fopen(dictionary, "r");
bool load(const char *dictionary)
{
// TODO
...
0
votes
1answer
39 views
CS50 Speller Not Free of Memory Errors
When I run check50 on my code, valgrind says:
Conditional jump or move depends on uninitialised value(s): (file: dictionary.c, line: 34)
112 bytes in 2 blocks are still reachable in loss record 1 of 1:...
0
votes
1answer
29 views
speller - unload returns false …?
unload returns false and i am not sure why....
when i run Valgrind i get this:
HEAP SUMMARY:
==7885== in use at exit: 608 bytes in 2 blocks
==7885== total heap usage: 143,096 allocs, 143,094 ...
0
votes
1answer
35 views
cs50 speller code complies and run also successfully. but it not qualifying for big board
:) dictionary.c and dictionary.h exist
:) speller compiles
:( qualifies for Big Board
expected exit code 0, not 139
:| passes benchmarking
can't check until a frown turns upside down
how to fix this
*...
0
votes
0answers
19 views
Pset5: Problem with loading multiple words with the same hash number
I am having problems with loading multiple words with the same hash code. The hash function I chose, from what I can understand, takes the ascii codes of all of the words in the dictionary, and ...
0
votes
0answers
52 views
CS50 pset5 Speller - Code Does Not Compile Due to Issue with Hash Table/Load Function
I've been working on Speller for a little while now, but I've run into a roadblock. I finished my first draft of speller and have been clearing up errors until this point. Here's my dictionary.c so ...
0
votes
0answers
28 views
code can't handle substring property
// Implements a dictionary's functionality
#include <stdbool.h>
#include "dictionary.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype....
0
votes
1answer
53 views
CS50 Pset5 Speller
I am having problems with Pset 5 Speller. I believe, I'm nearly there, I can get all functions to run and compile successfully, however my outputs are not quite right. I have attached comments to make ...
0
votes
2answers
56 views
CS50 Speller returns all word as mispelled and I can't find any mistake in my code
I need help, I can't get around this problem set. I have searched everywhere and I think the code is equal to most of the other students... The problem is that the check function is returning true ...
0
votes
1answer
28 views
pset5 speller “Could not load dictionaries/large” error
#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include "dictionary.h"
#define ...
0
votes
0answers
33 views
CS50 Speller valgrind issues and
I'm new to CS and could really use some help on the speller pset. I've got a basic outline that doesn't seem to seg fault, but I'm still having issues. It fails check50 in that:
it doesn't handle ...
0
votes
1answer
25 views
pset5 case sensitive check fail
:) dictionary.c, dictionary.h, and Makefile exist
:) speller compiles
:( handles most basic words properly
expected "MISSPELLED WOR...", not "MISSPELLED WOR..."
:) handles min ...
0
votes
0answers
29 views
pset5 - Conditional jump or move depends on uninitialised value(s)
Here is my code:
// Implements a dictionary's functionality
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include ...
0
votes
1answer
53 views
Speller pset 5: Valgrind gives me error
I am doing pset 5 speller and It seems to be okey less valgrind check.
Valgrind HELP50 gives me these errors
==22585== Use of uninitialised value of size 8
==22585== at 0x40110B: hash (dictionary.c:...
0
votes
0answers
42 views
PSET5 dictionaries won't load
I cannot get my dictionaries to load and cannot figure out why. Here is my load function:
// Loads dictionary into memory, returning true if successful else false
bool load(const char *dictionary)
{
...
0
votes
2answers
50 views
Pset 5 Help understanding Valgrind output
I was wondering if anyone could help me with interpreting the Valgrind error to trouble shoot. There are no memory leaks, but I am getting this error "Conditional jump or move depends on ...
0
votes
1answer
37 views
Pset5 - :( program is free of memory errors valgrind tests failed; rerun with --log for more information.)
// Implements a dictionary's functionality
#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#...
0
votes
1answer
27 views
pset 5: Repeat Until?
Trying to read strings from file in the [load] function of speller. When using fscanf(), how do I start a while loop until it returns "EOF"? I think there's got to be an easy way to do this, ...
0
votes
1answer
63 views
CS50 pset5 segmentation fault
I've spent a whole day trying to solve pset5. When i try to run the code it kept showing "Segmentation fault".
Here's what i get from Valgrind
==21210== HEAP SUMMARY:
==21210== in use at ...
0
votes
1answer
60 views
Speller week 5 Segmentation fault
I can't understand where and what my error is
I think it's because of "load", but I can't fix it
it returns an error when checking
:) dictionary.c, dictionary.h, and Makefile exist
:) ...
0
votes
0answers
88 views
PSET 5 SPELLER - HELP!
i'm not sure why this happens when I execute the code. The program seems to never end as if it's running an infinite loop. When I run valgrind on it misspelled words keep spewing out and it gives me a ...
0
votes
1answer
26 views
Pset5 - Where am I leaking 1 block of memory?
// Implements a dictionary's functionality
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include "dictionary.h"
#include <string.h>
#include <...
0
votes
1answer
31 views
PSET 5 SPELLER - segmentation fault
I keep getting a segmentation fault on my load function when using the debugger. Specifically, the line with "if(table[num]->next != NULL)" is what is causing it. I need some help, please....
0
votes
1answer
65 views
pset5 valgrind tests failed
I'm very close to completing pset5; all smiley faces except the Valgrind memory leak. I'm hoping someone can help find the problem. I am only leaking 112 bytes and have tried to fix the issue by ...