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
0
votes
0answers
12 views

speller identifies most words as mispelled

Despite memory problems to be fixed, my code compiles fine and runs but returns almost every word that it checks as mispelled. I have spent so long looking at all this now that I am worried it just ...
0
votes
1answer
297 views

pset5 load with a trie Killed

I'm having a lot of trouble with my pset5. I'm attempting to use a trie to load the dictionary. It will compile but nothing really more than that. when using gdb, the program shows "Killed" in the ...
0
votes
1answer
928 views

Incompatible pointer types even though they are both char*?

dictionary.c:70:20: error: incompatible pointer types passing 'char *[46]' to parameter of type 'const char *' [-Werror,-Wincompatible-pointer-types] if (strcmp(checker->word, lowword) == 0) ...
0
votes
1answer
158 views

SEG FAULT in check

This is my check function typedef struct node { char word[LENGTH+1]; struct node* next; }node; static node* table[N]; bool check(const char* word) { for (int i = 0; i < N; i++) ...
0
votes
1answer
556 views

Rewrite method in resize.c

I am currently trying to conceptualize the idea of creating the vertical nth copy for resize.c but I don't grasp how the file position indicator can tell when there is a new line. How do I tell C to ...
0
votes
2answers
32 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
347 views

Pset5 speller: how can I navigate through the Trie and free the nodes?

so I am stuck on this PSET5 speller for a quite while now, trying different approaches, looking at available information in CS50, shorts, pset problem explanation and I couldn't get to free all the ...
1
vote
1answer
396 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 ...
0
votes
1answer
254 views

Pset5: files compiled but report segfault when run. I'm completely lost

I've been doing this pset for 3 weeks. This is the hardest pset ever. The segfault seems relevant to the free_node() function. But the valgrind report is full of confusing jargon. I'm completely lost. ...
1
vote
1answer
530 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 = ...
0
votes
1answer
65 views

CS50 pset5 segmentation fault

I've spent a whole day trying to solve pset5. When i try to run the code it kept showing "Segmentation fault". Here's what i get from Valgrind ==21210== HEAP SUMMARY: ==21210== in use at ...
0
votes
1answer
834 views

Conditional jump or moves depends on uninitialized values

I am getting the following valerind error. ==9649== Conditional jump or move depends on uninitialised value(s) ==9649== at 0x80493AD: check (dictionary.c:152) ==9649== by 0x8048A6D: main (...
0
votes
1answer
318 views

pset5 speller doesn't handle possesive and substrings properly

I got the following error while checking my pset5. :( handles possessives properly \ expected output, but not "\nMISSPELLED WORDS\n\n\nWORDS MISSPELLE..." :( handles substrings properly \ ...
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 ...
0
votes
1answer
279 views

pset5 speller (using tries)

When I run my program, the program output every single word in the text instead of solely misspelled words. I'm fairly confident the problem lies within my load function. Can someone identify anything ...
0
votes
1answer
115 views

recursive trie generation segfaultin

Halp, I'm trying to implement a clever and zippy recursive trie makin function for load() in pset5, but my program's exploding when I trie, and I'm struggling to educe the problem (probably an ...
0
votes
1answer
372 views

Recover pset5 scope?

I'm almost there, but one more question about recover.. In my code, I open a file inside an if condition, but how do I acces that file later? It's getting out of scope and I'm getting use of ...
0
votes
1answer
102 views

where can i get ppt of Zamyla's explanation in pset5

I didn't find anywhere to get that, I just want to get the ppt of zamyla's ppt in pset5, it help me to walkthrough the problems.
0
votes
1answer
474 views

Error: double free or corruption when running recover

After a very long time, I finally managed to find out why my version of recover.c only managed to recover 1 image (recover.c only recovers 1 image) Anyway, now I face a new problem. What I've ...
0
votes
1answer
721 views

pset5 trie load function killed with large dictionary

This has been bugging me for weeks. The program seems to run OK with small dictionaries, but gets killed with medium size - after around 95,000 words - it varies. LETTERS is set to 27. Any help would ...
0
votes
1answer
201 views

Pset5 Unload - Recursion with Tries - Fails Valgrind with apostrophes

I'm getting a strange problem in my unload() code, or more specifically the freeNode() recursive function that unload() calls. I think I have the recursive part of the function nailed; once free(...
0
votes
1answer
137 views

Speller.c - need help on check

For an unknown reason some words that are in the dictionary and in the text file as well are marked as misspellings in the statistics. Though, the code passes check50 except the last paragraph saying ...
0
votes
2answers
158 views

Segfault in pset5 in load

My implementation of load uses a trie and when I attempt to access the bool is_word I get a segfault. Can you guys help me out? Any suggestions on how to improve my code would be amazing. Thanks ...
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 ...
0
votes
1answer
105 views

expected output, not standard error

My program compiles and runs fine. There isnt even much memory leak. But still it doesn't pass the cs50 check. Link to my check code
0
votes
2answers
393 views

pset5 valgrind not happy with load (also, using malloc vs calloc on trie)

First, valgrind flags the file pointer at the fopen call, and also the malloc call to the root pointer. It designates both still reachable in loss record. Second, since for pset5 I check for an end ...
2
votes
1answer
27 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
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@...
0
votes
1answer
604 views

pset5 load speller.c, seg fault with gdb

Changing this question to be specific. My load function seems to run past the end of the cs50 small dictionary to give a segmentation fault after it works for cat and caterpillar. I can see that cat ...
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 ...
0
votes
1answer
67 views

Speller week 5 Segmentation fault

I can't understand where and what my error is I think it's because of "load", but I can't fix it it returns an error when checking :) dictionary.c, dictionary.h, and Makefile exist :) ...
0
votes
1answer
83 views

Segmentation fault! when i execute the program it suffer segmentation fault but when i run debug50 everything is fine!

/** * Implements a dictionary's functionality. */ #include <stdbool.h> #include <stdlib.h> #include <string.h> #include <stdio.h> #include "dictionary.h" typedef struct ...
0
votes
1answer
356 views

Pset 5 Load Function

I'm having trouble with my load function... I had it working previously, but after changing some stuff and dealing with the check, I ran into this issue and can't seem to figure it out... Every time ...
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 ...
0
votes
1answer
1k views

Why won't speller load large dictionary in pset5?

In pset5, Speller won't load the large dictionary. Per the pset instructions, I seem not to have implemented my dictionary.c properly. Below are the beginning of my dictionary.c load section, and ...
0
votes
1answer
110 views

pset5 unload base case

I haven't written any code yet, although I've written pseudocode for this problem, and I keep coming back to the issue of base case. I built a trie and now want to recursively unload it. I think I've ...
0
votes
1answer
125 views

pset5 check-all misspelled?

I have the following code for check. I'm testing it against dictionaries/small and a test.txt and all words are coming back as misspelled? I don't understand why all words are coming back misspelled? ...
0
votes
1answer
108 views

Pset 5 Dictionary TRIE Segfault

I know posting the while code is not cool, but I frankly can't figure out what is wrong anymore. I should have done this with something easier than trie-structure, but since it is close to done I'd ...
0
votes
1answer
138 views

i don`t know what is wrong with my unload function?

enter code here /** * Implements a dictionary's functionality. */ #include <stdbool.h> #include<cs50.h> #include <strings.h> #include <stdio.h> #include <...
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 ...
0
votes
1answer
288 views

Why i get wrong horizontal resize

I\m really stuck in the formula for horizontal resize.For my new padding if i enter 4 for (n) i get for my new padding answer 1, is that correct? fpos_t startline; for (int a = 0, biHeight = ...
0
votes
0answers
14 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
659 views

Not sure why resize.c isn't working

resize.c compiles and runs, but produces an image with a lot of black space. A fresh set of eyes on my code is welcome to see where I have gone wrong. I assume it has to do with padding but I can't ...
0
votes
1answer
26 views

Pset5 - Where am I leaking 1 block of memory?

// Implements a dictionary's functionality #include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include "dictionary.h" #include <string.h> #include <...
0
votes
1answer
207 views

Running time of speller.c/pset5

I am stuck into this for long and seems like no way out. I have tried implementing speller.c/pset5 using hashtables and my code passes check50 but I get a total running time of 0.5 on an average ...
0
votes
1answer
34 views

PSET 5 SPELLER - segmentation fault

I keep getting a segmentation fault on my load function when using the debugger. Specifically, the line with "if(table[num]->next != NULL)" is what is causing it. I need some help, please....
0
votes
1answer
80 views

Help with seg fault in pset5 speller

My speller seg faults at the space following the first word in whatever input text I use. Here is the gdb output for austinpowers.txt with the segfault just after reading the word AUSTIN: 107 ...
0
votes
1answer
102 views

Segmentation fault..Please Help

can anyone have a look at my code, find the problem and suggest improvements. im getting segmentation fault after calling 'check' function. typedef struct trie { bool word; struct trie* link[27];...
0
votes
1answer
80 views

pset5 valgrind tests failed

I'm very close to completing pset5; all smiley faces except the Valgrind memory leak. I'm hoping someone can help find the problem. I am only leaking 112 bytes and have tried to fix the issue by ...
0
votes
3answers
50 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 ...

1
2 3 4 5
24