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.

259 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1 vote
1 answer
80 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
1 vote
1 answer
62 views

What is the usage of creating DICTIONARY_H in pset5?

I cann't understand when to use the preprocessor directives as (ifndef, define ,etc.)? In dictionary.h, what is the importance of writing those statements? and regarding the reason that was mentioned ...
Aya Othman's user avatar
1 vote
1 answer
159 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 ...
andream's user avatar
  • 109
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
1 vote
1 answer
188 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
1 vote
1 answer
71 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
1 vote
1 answer
447 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.....
Ojou Nii's user avatar
  • 731
1 vote
0 answers
136 views

pset5 submit50 slug

Hi, guys. I am facing this problem you can see on the uploaded picture. Cheers!
Rudolf Fonseca's user avatar
1 vote
1 answer
215 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 ...
SnezhinaT's user avatar
1 vote
1 answer
412 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 ...
AdiKhajuria's user avatar
1 vote
0 answers
260 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 ...
Kevin King's user avatar
1 vote
1 answer
72 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 ...
Furrukh Jamal's user avatar
1 vote
0 answers
141 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 ...
Junho Choi's user avatar
1 vote
1 answer
535 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 = ...
jaguar's user avatar
  • 70
1 vote
1 answer
144 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. ...
Glenn English's user avatar
1 vote
1 answer
236 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@...
CharlesD89's user avatar
1 vote
1 answer
440 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 ...
CharlesD89's user avatar
1 vote
0 answers
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 ...
PaulJ's user avatar
  • 11
1 vote
3 answers
428 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 ...
DreamWave's user avatar
  • 111
1 vote
1 answer
193 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 ...
Sandwich's user avatar
1 vote
1 answer
513 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 ...
aharris's user avatar
  • 19
1 vote
1 answer
381 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 ...
sugoi_overload's user avatar
1 vote
1 answer
202 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) ...
James Goldstein's user avatar
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
0 answers
35 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 ...
dhan8293's user avatar
0 votes
0 answers
31 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. ...
Alkir man's user avatar
0 votes
1 answer
194 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 ...
domionico's user avatar
0 votes
1 answer
18 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 ...
Mateus Machado's user avatar
0 votes
1 answer
33 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 ...
esqflowne's user avatar
0 votes
1 answer
33 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> #...
shirin's user avatar
  • 1
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 <...
aidiotwholikescoding's user avatar
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 ...
Victor Araya's user avatar
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?
Sharyar Javaid's user avatar
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:...
Aleksey Tsalolikhin's user avatar
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 ...
Two-FaceFIL's user avatar
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.]
Santhosh's user avatar
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 ...
dohaal's user avatar
  • 1
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 ...
Li-Yu Chu'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
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
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
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
996 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
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
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
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
45 views

Collatz Function Iteration

Guys help here I'm so lost as how to answer this question, I'm infact clueless...Find the two smallest different input numbers x,y (with 0<x<y), for which the COLLATZ algorithm takes equally ...
HAPPY DUMMY's user avatar
0 votes
1 answer
228 views

Valgrind says 8,013,096 bytes in 143,091 blocks are still reachable in loss record 1 of

Hi) I understand that something incorrect with unload function and that 143,091 blocks it's basically the number of words in the dictionary that was uploaded by the program and I didn't manage to ...
NikitaKvitka's user avatar

1
2 3 4 5 6