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

Pset5 : Valgrind seg fault in load function

Currently doing the pset5, and keep getting seg fault when running Valgrind. This is the error messsage I get: /etc/profile.d/cli.sh: line 94: 1150 Segmentation fault valgrind ./speller texts/...
0
votes
3answers
176 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
173 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
55 views

pset5 Speller: dictionary loads, but text will not

Hello Stack Exchange Team. I am having an unusual issue that I am not sure how to tackle. I am working on the problem set speller. I have written all of my code into dictionary.c as instructed. I ...
0
votes
1answer
42 views

PSET 5 My hash table doesn't seem to be storing correctly

When I load the dictionary, I add the words to the hash table, by calling the hash function to calculate the bucket ID, then add hash function to actually insert it into the list. Inside the addhash ...
0
votes
1answer
34 views

My code matches the outputs in the keys, but does not pass check50

The code is here: // Implements a dictionary's functionality #include <stdbool.h> #include "string.h" #include <strings.h> #include <ctype.h> #include <cs50.h> #...
0
votes
1answer
62 views

PSet5 Speller, passing test cases but not check50

I'm implementing the most basic form of the speller function, using 27 buckets for A-Z and ' (apostrophe) . My code works for the test cases (i.e. the generated results match those in keys/) but when ...
0
votes
1answer
129 views

PSET 5 Speller Failing free memory of errors final check

So i am so close to finally completing this present and i still have some final errors to go through. Valgrind is saying that it is still leaking memory for some reason and i cant find the reason why. ...
0
votes
0answers
17 views

One block still reachable plus other advice

I am trying to do pset5 speller and am running into a lot of problems Can't figure out what the problem is here. https://pastebin.com/fBkFeDA9 Also saw that the hash function is giving out negative ...
0
votes
1answer
93 views

PSet5, Speller, all correct but problem with Valgrind

I am so close to finally finishing Speller, however I'm running into an issue with Valgrind that I don't understand. I was under the impression that when I malloc a node for the dictionary table in ...
0
votes
1answer
31 views

Pset5 segmentation fault due to sprintf

// Loads dictionary into memory, returning true if successful else false bool load(const char *dictionary) { int i; for (i = 0; i < 5382; i++) { table[i] = NULL; } int ...
0
votes
2answers
53 views

strcpy not working with struct items

bool load(const char *dictionary) { char splitStrings[9999][45]; FILE* dict = fopen(dictionary, "r"); node* item = table[0]; int i = 0; for (i = 0; fscanf(dict, "%...
0
votes
1answer
23 views

dictionary is allways null

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

pset5 speller, passes all Check50 requirements except the last one (Valgrind)

My code is now working fine but misses out on fully completing Check50 because of the last requirement. Running ~/pset5/speller/ $ help50 valgrind ./speller texts/cat.txt, it returns: ==6259== ...
0
votes
1answer
37 views

PSet5 Speller, Load Function, help50 Valgrind returns “==2480== Conditional jump or move depends on uninitialised value(s)” at the strcpy line

I've been working on Speller for a while now, but I've been stuck on this same problem. When testing my code by running ./speller texts/ANYOFTHETEXTS, it says I load 143092 words, but it also always ...
0
votes
1answer
26 views

pset5 speller everything works but the program won't end

okay so i have done everything correctly in terms of getting the right results i get a correct number of misspelled words and the time is low enough. i just can't get the program to end. val grind ...
0
votes
1answer
54 views

PSET5 speller memory leak and dictionary not unloaded

I have been looking at this for about 5 days now and I can´t find where I am leaking memory or if I have any problems with my code logic. Everything compiles and Valgrind output is below. I am ...
0
votes
1answer
53 views

Pset5 Speller: every word in text reported as misspelled

Code compiles, dictionary loads and unloads, word count works and hash function seems to work. However, the results show that every word in the text is misspelled. I’ve spent 3 weeks tweaking the code ...
0
votes
1answer
52 views

Speller.c doesn't work

I've spent pretty much time trying to solve a speller and got really stuck, don't know what's wrong with my code. It compiles but check50 says it's totally incorrect. I would be grateful if you could ...
0
votes
0answers
21 views

Help me with Pset5 filter

// Implements a dictionary's functionality include include "dictionary.h" include include include include define HASHTABLE_SIZE 1000 // Represents a node in a hash table typedef struct ...
0
votes
1answer
33 views

PSET 5 segmentation fault on checker

I figured out that the problem is the checker. The output of this code is a segmentation fault. I think I followed everything on the walkthrough. Here is the result that I got: the result of the code. ...
0
votes
0answers
34 views

Help me with Pset 5 Speller

Help me Guys Where did i go wrong in my code // Implements a dictionary's functionality include include "dictionary.h" include include include include define HASHTABLE_SIZE 1000 // ...
0
votes
0answers
54 views

check50 keeps printing “Could not load basic/dict.” what might be the problem in the code?

// Implements a dictionary's functionality include include include include "dictionary.h" include include include // Number of buckets in hash table define N 120000 //maximum length of ...
0
votes
2answers
52 views

Valgrind errors: “invalid read of size 8” and “…uninitialised value” (pset5, speller)

I have basically finished the code, no memory leaking and tests work out fine. However, Valgrind is not happy: Conditional jump or move depends on uninitialised value(s): line 141 This is one of the ...
0
votes
1answer
55 views

PSET 5 Unload Segmentation Fault

I've been stuck on this problem set for a while now. Valgrind is telling me I have a problem in my unload function, which is "Conditional jump or move depends on uninitialised value(s)". I can't find ...
0
votes
2answers
37 views

Linked list, List isn't passing by reference?

I've really been struggling with PSET5 so I decided to take a step back and write a simple linked list program. My program take in an array of characters as a command line argument and stores each ...
0
votes
1answer
83 views

CS50 Pset5 error: conditional jump or move depends on uninitialised value(s)

valgrind is showing me an error that I have trouble understanding. The error is "conditional jump or move depends on uninitialised value(s)". Valgrind is directing me to line 125 of my code, which is ...
0
votes
2answers
116 views

PSET5 Speller - Memory error

This has by far been the most rage-inducing pset in the course. Down to my last check50 error now, failing the "program is free of memory errors" test. I've run it in Valgrind and it says there are ...
0
votes
1answer
64 views

cs50 Pset5 Valgrind Error

I'm just about to finish pset5 but I'm stumped on this valgrind error. Check50 tells me everything works well except that I am leaking memory. Valgrind tells me the memory leak is coming from line 44 ...
0
votes
1answer
52 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

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

CS50 Speller Load function

I looked through my load function with debug50 and realised that each time the loop is iterated, the pointer temp always gets assigned the same value despite freeing it, how do Igo about resolving ...
0
votes
1answer
253 views

Need help: pset5 “Speller”

I am having a strange issue with the pset5. When I debug the file, it works fine, but when I check it through Check50, it throws several frowns at me. Need suggestions. Here is my code: #include <...
0
votes
1answer
57 views

almost there, but Valgrind reports an uninitialised value

Thanks in advance for helping out an old Dutchie! I am almost there, but valgrind insists i have an uninitialised value on in the While loop: while (cursor != NULL) VALGRIND tells me ==...
0
votes
1answer
150 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
1answer
62 views

pset5 speller load - check function it does compile but my words in dictionary output are not correct

the following function is my load - check functions. I believe one of two have the issue but not sure which one. Thanks for the help. My cs50 checks are like the following : WORDS MISSPELLED: ...
0
votes
1answer
83 views

pset5 speller “Could not load dictionaries/large”

I cannot figure out what I am missing. Program keeps returning "Could not load dictionaries/large" I have checked and tried different suggestions from similar questions but I do have the folder ...
0
votes
1answer
18 views

Pset5 Speller: Valgrind error with bool check

I solved every memory leak I had, but I'm having some issues with this one. What's a good method to free memory from node* checker in this case? bool check(const char *word) { node *checker = ...
0
votes
1answer
85 views

Valgrind shows memory error pset5

My code is // Implements a dictionary's functionality #include <stdbool.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <strings.h> #include <...
0
votes
2answers
37 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 ...
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 "...
0
votes
1answer
42 views

Speller Load doesn't see certain words

My load function sometimes overlooks certain words in the dictionary. For example it jumps over the word "nodes" instead of loading it into the hash table. bool load(const char *dictionary) { // ...
0
votes
0answers
83 views

Shows double free or corruption (fasttop)

// Implements a dictionary's functionality #include <stdbool.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include "dictionary.h" // Represents a node in a ...
1
vote
1answer
177 views

pset5 Speller: No Correct Output

I have tried again and again different ideas but I simply can not get Speller to find the right misspelled words. I have no idea what I'm doing wrong. I keep changing things in various functions to ...
0
votes
1answer
56 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
1answer
26 views

Speller Works on all .txt files, but FAILS Check50

My Speller function works on all the .txt files provided with the keys. I even made a .txt containing the large dictionary and all the words are spelled correctly. However, when I go to use Check50 ...
0
votes
2answers
93 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
2answers
42 views

Memory issue (Valgrind “Still reachable”)

My code seems to pass all the Check50 tests except the one for memory as valgrind returns a "still reachable" error. Not sure what needs to be done, any help will be appreciated. Thanks! My Code #...
0
votes
1answer
86 views

Valgrind uninitialized values pset5

This is my solution for pset5's speller problem, which uploads a dictionary with a hash table and checks an inputed text to find misspelled words. My code works fine when I run, but valgrind says "...

1 2
3
4 5
24