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
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
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
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
529 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
216 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
118 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
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
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
2answers
679 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
151 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
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
2answers
845 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
899 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
289 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
642 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
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
602 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
97 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
179 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
113 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
606 views

CS50 good hash function for PSET5 Speller

I was looking up different hash functions and was getting really confused following what the code was doing. I stumbled upon this hash function: int hash(const char * str) { int hash = 401; ...
0
votes
1answer
200 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
95 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
109 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
59 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 ...
0
votes
1answer
232 views

PSET5 speller - I cannot understand tries at all

I am so completely lost. I completed PSET5 with a hash table, and the concept of hash tables makes sense to me. Now I am attempting to do it with a trie, and I am just so confused I don't even know ...
0
votes
1answer
848 views

Pset 5 - Big Board error but program passes check50 and no valgrind errors

Have finished Pset5 and succesfully passed check50. Valgrind also shows no errors. However, when I want to submit for Big Board, to see how my program runs against those of others I get a error ...
0
votes
1answer
41 views

PSet5 Speller - program can't identify the Misspelled words

can someone have look at my PSET5 - speller code. I have tried to fix it for five hours, and I don't seem to go anywhere. Thanks in advance! typedef struct node{ char word[LENGTH+1]; struct ...
0
votes
1answer
140 views

pset5 speller works, check50 fails, segfault with small dictionary

I've finally got my speller to work for the large dictionary and the given texts. Valgrind doesn't give any errors anymore. However, check50 fails, because the 'actual output' received there does not ...
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
1answer
72 views

expected expression pset5 dictionary.c if-else

I am having troubles with the check function in dictionary.c in pset5. Here is my code: /** * dictionary.c * * Computer Science 50 * Problem Set 5 * * Implements a dictionary's functionality. ...
0
votes
1answer
88 views

Problem with edX pset 5 - Spellchecker load - segfaults with large dictionary

Below is the code from my spellchecker load procedure; other parts of the code omitted. When I use a small dictionary, everything seems to run fine, but when I try to load the large dictionary, I get ...
0
votes
2answers
83 views

check50 showing unexpected end of input

I have checked my output with staff output using diff function and was getting same output although the first time I ran check50 it gave ":(" to all conditons except the existing and compiling ones ...
0
votes
1answer
611 views

Segmentation fault - load() function

This is my code for load() function. When I am doing "./speller text" it is showing Segmentation fault. Please help. typedef struct node { char name[LENGTH+1]; struct node* next; }node; node*...
0
votes
2answers
284 views

All words are misspelled even with the dictionary is loaded. Help?

Im not quite sure what is the problem with checking the words in the dictionary against loaded texts. All words within in the loaded txts return mispelled even with my dictionary loaded with the right ...
0
votes
1answer
184 views

pset5 Speller, Segmentation problem

So I finished speller and am debugging and getting a segmentaiton error when I am trying to set the array in my root node to NULL. I have defined my Struct at the beginning of Dictionary.c and ...

1 2 3
4
5
24