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
2answers
784 views

resize vertically doesn't work

First of all I know there are a lot of other questions like this but I have looked at all of them. They have helped a lot but I am still stuck. I can't see anything logically wrong with my code, but ...
0
votes
1answer
2k views

How to Resize an Image Vertically?

I'm able to resize a given .bmp horizontally, but the code for vertical resizing is not working. Here is my code for vertical expansion. // resize vertically //move pointer to start of scanline of ...
0
votes
1answer
29 views

Pset 5 speller load function and word

I'm working on my load function to obtain the "word" from dictionary and I obtain one of the next message dictionary.c:59:28: error: use of undeclared identifier 'word'; did you mean 'load'? ...
0
votes
1answer
45 views

pset5 speller load - i don`t get it

how do i check the logic of this ... i have not yet implemented the hash function ... can i check for errors without doing this or it is impossible to check without the hash function...? // Loads ...
0
votes
1answer
33 views

Can anyone see what is wrong with my check function?

#include <stdio.h> #include <string.h> #include <stdlib.h> #include <stdbool.h> #include <ctype.h> #include <strings.h> #include "dictionary.h" int s = ...
0
votes
2answers
51 views

Speller program runs accurately with memory leaks. When I add free() to correct memory leak, program stops executing

My speller program runs and produces accurate outputs. It passes all but one of the check50 checks. It fails because it has a memory leak. I added free() to the load loop where I am allocating ...
0
votes
2answers
59 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
3answers
193 views

PSET 5 Hash help

I started my load function without looking at any reference code (first time starting a pset this way) to give me an idea on how to implement my own version. I was mostly confident until I reached the ...
0
votes
1answer
68 views

Speller beyond my reach: all words marked as misspelled

The spectre of Speller is haunting me. The code below compiles fine, but comes a cropper in at least two ways - first, it marks all words as misspelled (is my hash function flawed? or am I loading ...
0
votes
1answer
55 views

PSET5 Speller - Just totally lost, code compiles but all check50 tests fail

I've been beating my head against a wall on this pset for 10 days now, watched all the videos, solved all the compiler errors, and just when I felt like I kind of understood this thing I ran the test ...
0
votes
1answer
196 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
1answer
160 views

PSet5 case-insensitive using strcasecmp

Tried iteration over strlen and random constant variable but unable to solve: :( spell-checking is case-insensitive expected "MISSPELLED WOR...", not "MISSPELLED WOR..." Here is my full code: //...
0
votes
2answers
38 views

PSET5 - Valgrind error - no enough bytes are being freed

I've been on this pset for some time now and everythin seems to be working except that there are some memory leaks and I really can't understand why. I've checked a lot of other people's codes but I ...
0
votes
1answer
79 views

Valgrind says no leaks possible. However has lots of errors

My code passes check50 apart from the memory leak section. Valgrind shows no leaks are possible but lots of errors: ==21401== HEAP SUMMARY: ==21401== in use at exit: 0 bytes in 0 blocks ==21401== ...
0
votes
2answers
89 views

pset5 speller almost all words are misspelled

I've looked through everyone with the same problem, the common answer seems to be lower-case issues in the hash function or freeing pointers before you are actually done using them. I have tried ...
0
votes
2answers
60 views

load function in speller not working properly not seem to figure out the correct way to link hastable?

Implements a dictionary's functionality #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <strings.h> #...
0
votes
1answer
107 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
1answer
65 views

CS50 pset5 program is free of memory errors valgrind tests failed;

I'm just minutes away from solving my problem in pset5. But I'm getting the following error from valgrind. ==12523== HEAP SUMMARY: ==12523== in use at exit: 0 bytes in 0 blocks ==12523== total ...
0
votes
1answer
529 views

pset5 speller case-insensitive

I have couple error I don't understand them at all first case-insensitive I write strcasecmp and still have an error bool check(const char *word) { int num = hash(word); for (node *c = ...
0
votes
1answer
182 views

Pset 5 Speller recursive unload

I've tried implementing a recursive function to free every node in each linked list in the hash table but it turns out it doesn't seem to free any memory as Valgrind shows there is a leak when calling ...
0
votes
1answer
126 views

Speller pset (check function) problem

I'm not sure what exactly is wrong with my code. I ran it through Valgrind, which says "Looks like you're trying to use a variable that might not have a value? Take a closer look at line 145 of ...
0
votes
1answer
47 views

Pset5 speller load returns member access within null pointer of type node

I am curently working pset5 speller in the load part and, when run with ./speller texts/lalaland.txt, returns the following dictionary.c:68:32: runtime error: member access within null pointer of ...
0
votes
2answers
518 views

PSET4 Speller(hashtable) cs50 2019 HELP!

Can somebody please help me whenever i execute check50 on my code i get this :( handles most basic words properly expected "MISSPELLED WORD...", not "MISSPELLED WORD..." :( handles min length (1-...
0
votes
1answer
132 views

singly linked lists walkthrough

Is anyone able to explain to me this function as mentioned in the walkthrough? sllnode* create(VAL val) I know it's a user defined function, and I have researched several pages of singly linked ...
0
votes
1answer
38 views

pset5 hashtable all words are mispelled, no memory leaking

I have been wrapping my head around this pset for several days and I have no clue on what is causing problems for my code (all words are 'mispelled'). Debug50 hasn't really been helpful :( I suppose ...
0
votes
1answer
32 views

How is my (custom) program leaking memory? I am preparing myself for pset5

I'm trying to understand how memory allocation and pointers work, since i find pset5 overwhelming. I made a simple program that reads characters from an array, and let them be written into both a new ...
0
votes
1answer
53 views

pset5 speller.c Question of segmentation fault and Valgrind

I am tackling CS50 Pset 5 speller.c. I successfully make speller.c, but when I tried to run the program, it showed "Segmentation fault". So I run valgrind, and the result is: ==14531== Invalid read ...
0
votes
1answer
80 views

PSET 5 - how to use the least memory - the magic trie sauce

Ive successfully finished the pset, and am mid-tier on the Big Board - but I have become transfixed with reducing space/time complexity. The only secret sauce Ive been able to glean is that those ...
0
votes
1answer
454 views

PSET5 check50 Speller HELP please!

I checked50 and this showed up program is free of memory errors valgrind tests failed; rerun with --log for more information. What did I do wrong? Valgrind showed no error... #include <...
0
votes
2answers
169 views

Pset5 - Valgrind causes 9544106 errors, Uninitialised value was created by a heap allocation

Im unsure if there is any error in my recursion in unloading/unload to free all memory. (But i doubt so because help50 tells me all my memory were freed- 367,084 allocs, 367,084 frees) I checked ...
0
votes
1answer
205 views

Pset5 trie unload -recursive function does not free memory

im close to finish this problem set , but i cannot figure out the working recursive function, especially if backtracking may work in this form of implementation: void rec_unload(node *trv) { for(...
0
votes
1answer
848 views

pset5 speller Invalid write of size 1

my implementation of dictionary.c passes all checks using check50 except memory leaks. I'm using valgrind and most of my leaks seem to be happening in my check function: // Returns true if word is ...
0
votes
1answer
449 views

Pset5 Speller Invalid read of size 8

after working on pset 5 speller for awhile, I've finally managed to make it run without any errors! However, the code's still incorrect when I check with check50 and valgrind. When I run valgrind ...
0
votes
1answer
130 views

Too many misspelled words in Speller Pset5

I know this question has been asked many times before, but so far none of the posts i read seem congruent with the exact problem i'm experiencing. When i run Speller with the (default) large ...
0
votes
1answer
149 views

Pset 5 Program running fine but doesn't pass check50

This is my first time posting here, I tried everything I could think of but couldn't solve this issue. Would appreciate any help I can get. Thanks! I tried to implement a hash table to solve pset5. ...
0
votes
1answer
206 views

pset5 speller valgrind show leak in load function

my speller code works very well with all texts but when i ran valgrind there was heap leak in load() specifically in new_node malloc can you help me figure out why? there is my code for load() and ...
0
votes
1answer
107 views

pset5 2017 unload() trie segmentation fault and undefined behavior

Having a lot of trouble with unload(). I've scrapped nearly working functions several times just in the hopes that starting over will fix things. I cannot figure out why my code keeps leading to the ...
0
votes
3answers
67 views

Segmentation error on PSET5 unload function

I'm working on the unload function for pset5 - speller and ran into segmentation errors with the first clear function below (dictionary.c unload function calls the recursive function clear). I ...
0
votes
1answer
243 views

Problem accessing the last element of the array

I've decided to implement the load function using trie, which I've defined as typdef struct trie { struct trie letters[27]; bool isWord; }trie; then later, when I try to ...
0
votes
1answer
80 views

too many misspelled words

I'm working on my spell checker, and everything seems to be compiling. However, when I run the spell checker, the number of words that it finds that are misspelled is way high. I'm not exactly sure ...
0
votes
1answer
371 views

Pset5 Speller - seems working but fails check50

My speller "seems" to work well as compared to the staff's solution: find the correct number of WORDS MISSPELLED (644 of austinpower.txt), correct number of WORDS IN DICTIONARY (143091 of dictionaries/...
0
votes
1answer
62 views

Pset5 - Check not returning expected output

My speller problem compiles and, as far as I know it, I can load and unload the dictionary correctly, but I'm not getting the expected output with check. I'm pretty inexperienced with code (CS50 is my ...
0
votes
1answer
33 views

CS50 PSET5 Memory Leak Speller

I am almost done with CS50 (working on the final project now) but one PSET of mine is incomplete. I can get it to compile and run, but Valgrind is not happy. Here's a snipped of the most relevant code ...
0
votes
1answer
132 views

Pset 5: Memory Leak in Speller

I have been trying to solve this for many days to no avail. It seems other many people have had similar problems with this pset, but when reading their questions, I had difficulty understanding what ...
0
votes
1answer
536 views

Pset5- speller could not load dictionary

This is what my terminal looks like when I compile and run my program. ('You messed up' is the error message I put in place for when in input dictionary is NULL) This is my full ide window. I ...
0
votes
2answers
593 views

Pset5 - Speller - Load (loading only 1 word in dictionary)

I'm still trying to cope up with Pset5 So what I have: program shows 14 from 17 words in text as misspelled and is ended with *** Error in `./speller': free(): corrupted unsorted chunks: ...
0
votes
1answer
259 views

STILL baffling check50 fail for speller.c!

I am totally stumped by the following problem. My code for dictionary.c compiles with 'make' without a problem. However, when I run check50 it fails the compile test with the error at this sandbox url:...
0
votes
2answers
98 views

Size of large dictionary trie structure seems very large

My speller seems to be working a-okay, but the dictionary load time is about 0.08 seconds slower than the staff implementation, and i wondered if that had something to do with an overlarge trie ...
0
votes
2answers
96 views

pset5. Can't trace memory leak

Load function (with a trie data structure) //DEBUG unsigned int allocs = 0; // define node and create root typedef struct node { bool is_word; struct node* children[27]; } node; node* root; ...
0
votes
2answers
195 views

check50 possessives and substrings

I don't really get why even though I handle the apostrophe case I think correctly here is what check50 gives me :) dictionary.c, dictionary.h, Makefile exist :) speller compiles :) handles most ...

1
3 4
5
6 7
24