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
71 views

Program runs fine with small dictionary, seg faults with the large dictionary

I have decided to use trie to implement load in speller and it works fine with the small dictionary (~14 words), however it seg faults with the large dictionary. Using valgrind, it says: Invalid ...
1
vote
1answer
842 views

pset5 speller: load() function not working properly

I'm getting pretty close to done with Speller but seem to have hit a snag. I can't really figure out why my load() function isn't working properly..it seems to skip over about 40,000 words in the ...
1
vote
1answer
1k views

PSET5 SPELLER: valgrind error: conditional jump or move depends on uninitialised value(s): but program runs correctly

When I run valgrind on my speller code I get errors that all look similar to this: ==4398== Conditional jump or move depends on uninitialised value(s) ==4398== at 0x401260: load (dictionary....
1
vote
1answer
42 views

Speller: Trie'ing and trie'ing to fix this seg fault, but to no avail

Salutations, good people. Been at this pset for a week and am at wit's end. I could really use some assistance. I've dug through a load of answered questions in hopes of finding a solution for myself,...
1
vote
1answer
1k views

PSET5 - spell checker. How can I make my code faster?

My code for pset5 works reasonably well, it passes check50 and isn't orders of magnitude slower than the staff solution, but I'm just wondering where I am losing time. I'm running my code on the large ...
1
vote
1answer
36 views

segmentation fault in in load using trie pset5

Can someone tell me why I get segmentation fault? bool load(const char *dictionary) { FILE *fp = fopen(dictionary, "r"); if (fp == NULL) { return false; } char word[45]; while (fscanf(fp, "%s",...
1
vote
1answer
201 views

pset5 check - do i need to allocate for '\0'? Also, do i need to strcpy when dealing with Const Char and Char?

So I'm building a side code to print out results before implementing onto pset5 dictionary.c I'm getting a seg fault stating i did not initialise the values, can someone help me out? Do i actually ...
1
vote
1answer
122 views

Memory leakage PSET 5

I've successfully implemented the dictionary and it fully works. When I run valgrind I get 2 nodes (224 bytes each) that are leaking. I really don't know how to fix this. Can someone help? ==1316== ...
1
vote
1answer
2k views

PSET5:Speller-Load, Am I on the right track?

Im having a little difficulty figuring out this, but I feel like im on the right track, but I basically want to make sure my load function at least makes sense. I've drawn it out on paper and it ...
1
vote
1answer
236 views

Pset5 Problem with Valgrind

I have completed pset5 and passed check50. But when i run it with valgrind, it is showing the following errors:- ==12042== Memcheck, a memory error detector ==12042== Copyright (C) 2002-2013, and ...
1
vote
1answer
205 views

pset5- possessives and substrings not working

I really need your help i have been banging my head almost 4 days now, check50 doesnt want to cooperate with me. whenever i run speller.c it loads the dictionary but it doesnt handle the words in ...
1
vote
1answer
98 views

Code passed check50, but the output does not match staff output and the code fails valgrind

``Thanks for your help so far on pset5. I have been able to implement pset5, the code is working properly, passed check50 but the output does not match the staff output. For instance, when tested with ...
1
vote
1answer
162 views

CS50 PSET5 - Segmentation Fault

When I was testing my code, I found that my code gives a segmentation fault using the large dictionary and is unable to load/open the small dictionary. Is this a result of my load function? Thanks in ...
1
vote
1answer
117 views

pset5 check function not working

I have tried to implement load/check function as best as I understand it. When I run it, it prints out all the words in the text as misspelled. I don't even know what is wrong with my code at all. ...
1
vote
1answer
109 views

pset5 load with tries, not permanently creating connections between nodes

I'm trying to use tries with pset5. Based on some error checking, it seems the newNodes I'm creating and the links between them are not carrying over from one word to the next. In other words, if the ...
1
vote
1answer
80 views

pset5: misspellings. Reading chars into word array

In the main for loop, how does the program know when the end of one word has been reached? for loop looks like this: for (int c = fgetc(fp); c != EOF; c = fgetc(fp)) if I understand it correctly, ...
1
vote
1answer
138 views

Need help with pset5 load function

I finished coding the load and check functions, but when I run the program, all the words in the selected text file, like the Austin Powers one, are coming out as misspelled. I am not sure if there is ...
1
vote
1answer
99 views

PSET5 Question about pointers

I had a question for dictionary.c. First, I'm still confused at why load and check imput is const char*. I understand that const char* means that the value that char* points to will never change and ...
1
vote
1answer
212 views

Some questions regrading pset5

so I do realize this is my 3rd post regarding pset5, but I really want to understand it. These are the three questions that I could not answer: My code for load() function uses fscanf to go through ...
1
vote
1answer
275 views

Unload function double free or corruption

so I've been battling through the fifth pset and this is where I can not find a proper way to continue. When I try to run it, it always aborts and gives this error: * Error in `./speller': double ...
1
vote
1answer
497 views

PSET5 Valgrind memory leak in load() and errors in many contexts

I'm trying to implement a trie for pset5. The program compiles, and appears to spit out the right output, except Valgrind seems to have a LOT of issues with it! First, there's the memory leak, which ...
1
vote
1answer
705 views

Pset5 - Questions.txt - Question 3

Can anyone give me a hint? I'm doing Pset5, and I can't seem to come up with an answer for "Why do you think we pass before and after by reference (instead of by value) to calculate, even though we’...
1
vote
1answer
106 views

How submit pset5 if solution uses external library

for pset5 I employed the wonderful CMPH Library http://cmph.sourceforge.net/ to create a perfect minimal hash. I've finished the project and it runs in a stunning 0.14 seconds, but, now I'm faced with ...
1
vote
1answer
399 views

CS50 PSET5 Speller Check Gets Skipped, All words misspelled

I am not sure why the words are all coming back misspelled, so I will post the global, check, and load. The run time shows that size and unload never get called. Any help is greatly appreciated. (PS. ...
1
vote
1answer
311 views

Problems checking pset5 --> can't load text

Last week I finally managed to get speller to work on the small files that I crated for testing. However, when I try to check the correctness of the program using any of the methods outlines in the ...
1
vote
2answers
650 views

pset5 speller valgrind still reachable

I'm using a trie data structure to tackle the spell checker. The code works fine and is almost as fast as the staff's implementation. Even check50 is happy about it. But when I run valgrind it throws ...
1
vote
1answer
62 views

pset5 - speller - valgrind says that there is one block left to free

I have the speller up and running, working properly and passing the cs50 automatic verification, but, independently of the size of the dictionary (even with a one word dictionary or an empty one) ...
1
vote
1answer
298 views

How to add a new node in the linked list

Now that I am done with pset5 I would like to understand how to add a new node to a linked list. While building the pset, I blindly used Zamyla's guidelines on how to add a new node to a linked list ...
1
vote
1answer
295 views

PSET5: Segmentation fault in load function

I get a segmentation fault whenever I run the program with the large dictionary, but not the small one, so I guess the error lies somewhere in load or unload but I can't localize it. The program also ...
1
vote
1answer
500 views

how to compile dictionary.c? [duplicate]

I'm having trouble figuring out the problem with my load function. here's the weird error I get (I've never seen something like it): jharvard@appliance (~/Dropbox/pset5): make dictionary clang -ggdb3 ...
1
vote
1answer
176 views

segmentation fault in speller

In speller I get a segmentation fault, what is strange that when i run the programm through valgrind it doesn't crash... In GDB I backtraced that there is a problem when trying to free(woord2). ...
1
vote
1answer
582 views

CS50x 2015 pset5 check50 & submission problem

SITUATION I enrolled in CS50x in late 2014. The class ended on 12/31/2014 and I was not able to finish in time. Enrolled in CS50x3 in 2015 and re-submitting my completed work where appropriate. ...
1
vote
1answer
693 views

why image color is not changing in whodunit?

I have made the below mentioned changes in my whodunit file but still the new image that is created is exactly similar to clue.bmp someone please help...
1
vote
1answer
559 views

How is biSizeImage calculated for a 1x1 BMP with n = 1?

I'm so close, but my program does not pass check50 because it doesn't resize a 1x1 BMP correctly when n is 1, 2, 3, 5 (i.e., when it needs padding). When I use peek to compare with staff for 1x1 and ...
1
vote
1answer
161 views

Makefile missing separator

I'm confused because I did this successfully at first, then my appliance crashed and I had to start over, and now I am having trouble with the Makefile for copy.c I have a file names "Makefile" that ...
1
vote
1answer
1k views

pset5 improper call to jpeg library in state 200

I am currently doing pset5 recover and I am getting the error mentioned in the title. My program is quite long, so I tried dimming it down, effectively only trying to recover the first image. Still, I ...
1
vote
1answer
284 views

check50 has 2 TODO's in red for resize.c

When I run my implementation of resize.c in check50, there are two "TODO's" in red at the bottom of some sections. Does anyone know what this means? (My programs output is identical to the staff's ...
1
vote
1answer
118 views

Can anyone tell why is this giving me a SEGFAULT?

typedef uint8_t BYTE; int main(void) { FILE* memcard = fopen("card.raw", "r"); if (memcard == NULL) { printf("something went wrong and file could not be opened"); return ...
1
vote
1answer
120 views

Why is this condition true if the characters in the buffer do not match?

As you can see, the if statement on the line 35 is false. Why is the body of the if statement being executed?
1
vote
1answer
37 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
2answers
44 views

Pset5: check unable to find words

Thankfully, I don't get any seg faults so I'm guessing unload() is working properly. Also, load() seems to run correctly when debugging, so I'm guessing the problem isn't on loading either. I don't ...
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
108 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
276 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
98 views

pset5 submit50 slug

Hi, guys. I am facing this problem you can see on the uploaded picture. Cheers!
1
vote
1answer
196 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 2
3
4 5
24