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.

248 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
1answer
31 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 ...
1
vote
1answer
47 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 ...
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
122 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
46 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
311 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
101 views

pset5 submit50 slug

Hi, guys. I am facing this problem you can see on the uploaded picture. Cheers!
1
vote
1answer
200 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
397 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
257 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
64 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
135 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
531 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
123 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
226 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
434 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
422 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
191 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
174 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) ...
1
vote
2answers
6k 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; ...
0
votes
2answers
10 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 ...
0
votes
1answer
14 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> #...
0
votes
0answers
17 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 ...
0
votes
0answers
23 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-&...
0
votes
0answers
20 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 ...
0
votes
1answer
26 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 ...
0
votes
0answers
19 views

PSET5: Memory Leak in unload

I am done with the code but valgrind tells my I still leak memory in my unload-function. I already checked if the code is working, and it does. With help50 I get the information that I leak 56B bytes ...
0
votes
1answer
28 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 ...
0
votes
3answers
54 views

PSet 5 Speller: How can the program tell if the dictionary has been successfully freed?

I'm pretty sure I'm just being dumb, but I've been wracking my brain and I'm drawing a blank. I've completed 5/6 of the functions in Speller, but the unload function has me stumped- the description ...
0
votes
2answers
65 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
26 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
27 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
36 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
0answers
20 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
19 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
67 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
42 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
20 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
75 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
104 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
64 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
33 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
34 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
28 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
32 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
57 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:...

1
2 3 4 5