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
1answer
854 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
146 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
74 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 ...
0
votes
1answer
2k views

Mispellings Questions.txt

I can't really figure out the correct answers for questions 3, 5 and 6 in questions.txt for problem set 5 (Mispellings). 3. Why do you think we pass before and after by reference (instead of by ...
0
votes
2answers
102 views

Trie filling with garbage value

While trying to implement the size function in pest5, I noticed I was seg faulting and traced it back to an error in the load function. It appears that after the first letter is read into the trie, ...
0
votes
1answer
400 views

How do I add leading zeros to the filename in `recover`?

I wrote a perfectly functional recover.c program yesterday. But I can't get the file naming right. How can I add leading zeroes to the file name so the name is 000 instead of just 0?
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
2answers
29 views

pset5 speller passess all checks except valgrind. no memory leaks but errors raised. confused

// Implements a dictionary's functionality #include <stdbool.h> #include <cs50.h> #include <stdlib.h> #include <stdio.h> #include "dictionary.h" #include <strings....
0
votes
2answers
41 views

Help In Solving Memory Leak For PSET5

I need to fix the memory leak error for me to complete pset5. When running my code, I get: :) dictionary.c exists :) speller compiles :) handles most basic words properly :) handles min length (1-char)...
0
votes
1answer
36 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
35 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
54 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
3answers
220 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
237 views

All misspelled words on pset5 speller

i'm having some trouble with speller, my code seems to detect words in dictionary and words in text fine, based off of check50 results, but for each check it seems all of my words come back as ...
0
votes
1answer
59 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
178 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
142 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
116 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
62 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
71 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
564 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
190 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
130 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
51 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
524 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
133 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
33 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
81 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
467 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
177 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
207 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
961 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
483 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
138 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
151 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
208 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
108 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 ...

1
3 4
5
6 7
24