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

Debug50 is not functioning properly

I was using debug50 over and over for pset5 speller and at some point it just stopped working. Now when I try to use it with simple programs it still won't work. I've restarted the ide from inside ...
0
votes
1answer
14 views

Pset5 - Speller - memory leak?

My programme runs and I'm passing all the checks bar the last one. When I run the check with --log I get this response: :( program is free of memory errors valgrind tests failed; rerun with --log ...
0
votes
0answers
10 views

pset5 - Conditional jump or move depends on uninitialised value(s)

Here is my code: // Implements a dictionary's functionality #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include ...
0
votes
2answers
33 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
1answer
22 views

Speller pset 5: Valgrind gives me error

I am doing pset 5 speller and It seems to be okey less valgrind check. Valgrind HELP50 gives me these errors ==22585== Use of uninitialised value of size 8 ==22585== at 0x40110B: hash (dictionary.c:...
0
votes
1answer
15 views

PSET 5 Speller - Unload leaking a ton of memory

I've been trying to read other questions on stack exchange about it and do research on it but I really couldn't find a solution for my unload problem. It doesn't seem to unload much. I tried a lot of ...
0
votes
1answer
36 views

Please help! I'm stuck on Pset5 Speller!

#include <stdbool.h> #include <stdlib.h> #include "dictionary.h" #include <string.h> #include <stdio.h> #include <ctype.h> int wordCount = 0; // Represents a ...
0
votes
2answers
19 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
1answer
19 views

Speller - not sure what's wrong

I'm struggling trying to find what the error is or why speller is behaving the way it is. Currently, when I run help50 valgrind, I get this error message: ==8634== 56 bytes in 1 blocks are definitely ...
1
vote
2answers
26 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 ...
0
votes
1answer
16 views

PSET5 Speller - Can't handle substrings properly

I've been doing the speller exercise for a while and I'm stuck in the "handle substrings properly". Here's my code: // Implements a dictionary's functionality #include <stdbool.h> ...
0
votes
1answer
18 views

CS50 (Speller) returns all words as misspelled

I'm right on the verge of cracking this problem. I ran the program on the small dictionary provided in the distribution code. It returned both words as misspelled. So I debugged the program. I noticed ...
0
votes
0answers
31 views

PSET5 dictionaries won't load

I cannot get my dictionaries to load and cannot figure out why. Here is my load function: // Loads dictionary into memory, returning true if successful else false bool load(const char *dictionary) { ...
0
votes
1answer
35 views

Pset5: Speller. incorrect counting of mispelled words

I've been working on this code for the last two weeks... I load the correct # of words into the dictionary, but I get an incorrect number for misspelled words. I believe its an issue either with my ...
0
votes
2answers
23 views

Pset 5 Help understanding Valgrind output

I was wondering if anyone could help me with interpreting the Valgrind error to trouble shoot. There are no memory leaks, but I am getting this error "Conditional jump or move depends on ...
0
votes
1answer
17 views

Pset5 - :( program is free of memory errors valgrind tests failed; rerun with --log for more information.)

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

Pset5 - ( program is free of memory errors valgrind tests failed; rerun with --log for more information

Please assist me how to resolve such an error. see my code below: // Scans dictionary word by word (populating hash table with nodes containing words found in dictionary) char word[LENGTH + 1]; while (...
0
votes
1answer
18 views

pset 5: Repeat Until?

Trying to read strings from file in the [load] function of speller. When using fscanf(), how do I start a while loop until it returns "EOF"? I think there's got to be an easy way to do this, ...
1
vote
2answers
31 views

Valgrind issue on PSET5 - Edited

sorry that this is a repost of a deleted question. I made a mistake in reading the specifications and didn't realise I wasn't able to alter the function declarations in dictionary.c & .h. The ...
0
votes
1answer
26 views

PSET 5 Speller- all words misspelled + memory leaking issues :(

I've tried fixing this problem for a while now, but I can't seem to figure it out. There are two main issues I am having: Firstly whenever I try running my code "./speller texts/lalaland.txt"...
0
votes
2answers
40 views

Pset 5 Speller - Load function crashing at strcpy?

My program compiles, but in debug50 it seems to get caught in a loop during the first strcpy in load. Any suggestions would be great thanks. // Implements a dictionary's functionality #include <...
0
votes
2answers
51 views

Pset5 Need help, the program doesn't work correctly and I can't find the bug

I have been all day trying to find the bug in my problem but I find it impossible. The program runs correctly at first but the misspelled words are not the ones expected, and then suddenly there is a ...
0
votes
1answer
36 views

PSET5 Speller everything works but then I catch all the words as misspelled

Basically when I run the test with texts/lalaland.txt and compare to the staff's key, they have something like 955 misspelled words and I have all but 5 misspelled. I tried to but a "tolower"...
0
votes
1answer
35 views

Pset5 Speller - Valgrind displays no leaks but code fails check50

any help would be much appreciated - I've been trawling other questions similar to this one but all the adjustments I have tried to make don't seem to fix the check50 failure. The code seems to run ...
0
votes
1answer
25 views

PSET5: Trying to implement dictionary.c using trie. But segmentation fault in check()

My implementation compiles but I am getting a segmentation fault when I execute. My program is working fine through the load function because the output screen shows this "~/pset5/speller/ $ ./...
0
votes
1answer
34 views

PSET5 Compiling issue

So I finally finished my code and received 20 errors when attempting to compile, after my first attempt fixing the errors I tried again and received 15 errors, once more and received 17, and now am ...
0
votes
1answer
51 views

CS50 good hash function for PSET5 Speller

I was looking up different hash functions and was getting really confused following what the code was doing. I stumbled upon this hash function: int hash(const char * str) { int hash = 401; ...
0
votes
1answer
48 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
47 views

valgrind Pset5 error

All checks with check50 are green except the memory error. This is what valgrind shows me: ==3259== ==3259== HEAP SUMMARY: ==3259== in use at exit: 8,013,096 bytes in 143,091 blocks ==3259== ...
0
votes
1answer
43 views

Pset5 speller getting valgrind error

My code // Implements a dictionary's functionality #include <stdbool.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <ctype.h> #include <...
0
votes
1answer
46 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
43 views

What is causing segmentation fault? I ran valgrind and help50 nothing seem to come up

help50 output: valgrind output: my code: // Implements a dictionary's functionality #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <string.h> #include &...
0
votes
1answer
23 views

pset5 speller: valgrind 937 errors from 1 context

I have done check50 and the only error is "valgrind tests failed; rerun with --log for more information". I can't find the source of the memory leak and I thought that my unload made sense. ...
0
votes
1answer
30 views

PSET5: memory leak in check function

bool check(const char *word) { unsigned int hash_index = hash(word); node *trav = table[hash_index]; while (trav != NULL) { int len = strlen(trav->word); char ...
0
votes
0answers
51 views

PSET 5 SPELLER - HELP!

i'm not sure why this happens when I execute the code. The program seems to never end as if it's running an infinite loop. When I run valgrind on it misspelled words keep spewing out and it gives me a ...
0
votes
1answer
28 views

PSET 5 SPELLER - seg fault

I need help with my unloads function. I keep getting a segmentation fault on "while(cursor->next != NULL)." When I hover over the "cursor->next" part it says no value. I don'...
0
votes
1answer
23 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
37 views

Pset5: strcasecmp doesn't return 0 when given the same string input

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

pset5 speller - valgrind & case sensitivity

So valgrind has identified line 102 as the potential source of memory leak which is the following within the load function: node *n = malloc(sizeof(node)); Have I missed freeing up this memory later ...
0
votes
1answer
16 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
68 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
62 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
58 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
30 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
35 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
31 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
56 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
61 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. ...

1
2 3 4 5
23