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
1
vote
1answer
281 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
99 views

pset5 submit50 slug

Hi, guys. I am facing this problem you can see on the uploaded picture. Cheers!
1
vote
1answer
198 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
136 views

Pset5 - Trie - using fgetc to read dictionary

Trying to figure out how to read my dictionary using fgetc. I was going to implement the reading using fgetc inside of a while loop. However, after peeking at example code on here, I see along of ...
1
vote
1answer
60 views

PSET5 - Trie code not working on large dictionaries

I'm completely stuck here. Running pset5 code and got a strange problem, code is not working as it should in large dictionaries, only in small ones. I think problem may be in load. I'm attaching load ...
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
1answer
184 views

Cant run ~cs50/pset5/speller texts/austinpowers.txt into IDE

I have just started PSET5 and in the text section the specs says to run the staff implementation by typing ~cs50/pset5/speller texts/austinpowers.txt but I am getting an error "Could not open texts/...
1
vote
1answer
93 views

Trie isn't working correctly in pset5

I thought my trie was finally working but when I ran it in the debugger using a dictionary containing the words cat and caterpillar, current->children[value] always equalled NULL. I have spent the ...
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
0answers
10k views

How to get rid of clang error: linker command failed? [duplicate]

When I am compiling dictionary.C on pset5 I got this error: clang error: command failed with exit code 1. Please help, thank you.
1
vote
1answer
217 views

pset5 load function segfault do not show in gdb

I cannot figure what's wrong with the code, it gives me a segfault, but runs in valgrind and in gdb. So far, i only wrote the load function, so anything else is still empty. #include <stdbool....
1
vote
1answer
119 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
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
1answer
49 views

Internet not working in appliance

I recently updated my computer to Windows 10 and the appliance was still there and it opened and I was able to continue working on pset5. The problem arose when I was finished and had to submit the ...
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
2answers
749 views

What is the meaning of this segmentation fault?

For recover.c my program compiles but when I run gdb I get a segmentation fault and I'm not quite sure what it means. When I run gdb I reach line 59 before I get this error message. I would like to ...
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
2answers
157 views

Pset5 - Code for dictionary.c works but valgrind returns memory leak

I chose to implement speller with a hash table and the code seems to be working fine and passes check50 except for a memory leak. I read other posts reporting similar issues and I think that the issue ...
1
vote
1answer
169 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
865 views

(pset5) valgrind - 1 block not freed

I've grinding away at this one problem for a couple of days now, and can't quite work out what's going wrong. My code passes check50. The output is fine. I'm relatively happy with how quickly it runs. ...
0
votes
1answer
925 views

Recover Buffer as uint8_t instead of int

I have been struggling through Recover when I noticed that the buffer on the walk through was a BYTE buffer; instead of just an int buffer;. After changing this my program finally worked! My ...
0
votes
1answer
2k views

Pset5 - Whodunit

What do we have to do in Pset 5 : Whodunit? I know we need to analyze a file, but all I see is a lot of red pixels.
0
votes
1answer
297 views

pset5 speller - how can index be >0?

I am trying to understand the 'spell-check each word in text' part of speller.c in pset5. How do we ever get an index >0? Index is set to 0 in the beginning and then the first if condition checks ...
0
votes
1answer
1k views

segmentation fault - pset5 recover.c

I have spent a long time looking through my code for a segmentation fault, but have not been able to find it. #include <stdio.h> #include <stdlib.h> #include <stdint.h> #define ...
0
votes
1answer
51 views

PSET5 speller segmentation fault

Can anyone help with segmentation fault. I have tried running debug50 and aparently the fault hits at line "if (head -> next != NULL)" in the load function. Aparently "table" is ...
0
votes
1answer
704 views

Pset5 : Speller: Valgrind : Blocks are still reachable

I have my code running well. But Valgrind still shows 568 bytes as reachable. Detailed Valgrind log is here: ==5709== ==5709== HEAP SUMMARY: ==5709== in use at exit: 568 bytes in 1 blocks ==5709=...
0
votes
2answers
1k views

pset5 load, hash function , lost :(

i am a beginner and wanted to solve the pset with hashfunction and than a linked list. I wanted to start out with the simplest way i can thought of. One bucket for every letter in the alphabet. Here ...
0
votes
1answer
1k views

Resize vertical help

After looking at several similar questions, I still cannot figure out why my code is not working! here is my vertical (this is in the beginning of the outer loop): if(a <= n) { ...
0
votes
1answer
595 views

recover.c recovers all images successfully, but check50 says it fails to recover the last. Any ideas why this is happening?

I have a while (!feof(infile)) loop, so that exits only when the eof is reached. And it closes all files upon exit. Here's the code: // scan input file while (!feof(infile)) { // read four bytes ...
0
votes
2answers
34 views

PSET5 Speller Load function skips the words from the dictionary

Struggling with the load function in speller for second week now. What I found using debug50 and placing "printf" between different lines of code is that the fscanf reads every second word ...
0
votes
1answer
2k views

How to make the check function faster?

It seems to be taking too much more time comparing to staff's implementation. The other 3 functions are average, though. dictionary.c: https://gist.github.com/9dcb901f2007d09ae1c9c4fa934f13df Mine: ...
0
votes
2answers
1k views

Completely stuck on LOAD in pset5 (hash-table)

I do really need help on LOAD. I can not figure out what exactly is going wrong with my code and if I am on the right track or not. I would appreciate any help. Besides, I'm getting an error: "...
0
votes
1answer
609 views

why does my program fail the “handles max length (45-char) words” check50 test?

At first, my code accidentally didn't support full 45 chars of a possible word. And so check50 returned the following: :( handles max length (45-char) words \ expected output, but not "\...
0
votes
1answer
98 views

pset5 selecting dictionary

Can someone walk me through line 42 in speller.c? I don't remember this syntax anywhere from the course and I can't figure it out. char* dictionary = (argc == 3) ? argv[1] : DICTIONARY; What does the ...
0
votes
2answers
181 views

Why Do We Add a char (A Byte) While We Need 3 Bytes?

In copy.c, in case we're copying a 3x3 bmp image, this piece of code adds the calculated padding to the bmp // then add it back (to demonstrate how) for (int k = 0; k < padding; k++) { fputc(...
0
votes
2answers
68 views

Speller Valgrind Issues

I've been trying to finish up the speller pset, and while everything works well, I keep getting a memory leak. When I rerun check50 with --log, I get: checking for valgrind errors... 56 bytes in 1 ...
0
votes
2answers
127 views

Pset 5 Speller - Load function crashing at strcpy?

My program compiles, but in debug50 it seems to get caught in a loop during the first strcpy in load. Any suggestions would be great thanks. // Implements a dictionary's functionality #include <...
0
votes
2answers
60 views

Pset5 Need help, the program doesn't work correctly and I can't find the bug

I have been all day trying to find the bug in my problem but I find it impossible. The program runs correctly at first but the misspelled words are not the ones expected, and then suddenly there is a ...
0
votes
1answer
229 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: :) ...
0
votes
2answers
105 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 ...
0
votes
1answer
131 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 ...
0
votes
2answers
62 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 ...

1 2 3
4
5
24