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

Pset5: check returns hashtable pointers as NULL despite hashtable values printed correctly in load

My check function returns all hashtable indexes as NULL (I printed a known index of 124 and still returns NULL), despite all indexes printed correctly in load. I am not sure where exactly the problem ...
0
votes
1answer
9 views

When declaring an array of pointers that will be a hash table, do you have to set all the elements of the array to NULL?

In the distribution code for Speller in pset5, they include this line in dictionary.c // Hash table node *table[N]; Should I set every element in the array to NULL, because they are pointers? (the ...
0
votes
1answer
18 views

Struggling with PSET5 Speller valgrind problems (& possibly more)

I've been working on PSET5 for weeks now on & off and I'm becoming really frustrated. I think I'm lacking some understanding of the malloc/free relationship, I'm not sure. Here's all of my code. ...
0
votes
1answer
8 views

pset5 speller check function: cursor pointer keeps being NULL

I finished writing the code and tried to run the program, but it returned all words as misspelled. When I ran debug50 on the check function, it shows that the cursor pointer does not take the value of ...
0
votes
1answer
9 views

Trying to fix a segfault in unload , pset5, speller

So when I originally wrote my code for the dictionary.c, I forgot to create the header nodes for each 'bucket' in the hash table. It ran well when every first node of each linked list had a letter, ...
0
votes
0answers
13 views

trouble loading dictionary

my load function seems to only load two words and all words are coming back misspelled. I don't know if the problem is with my load function or the hash function. I've gone over the load function ...
0
votes
1answer
19 views

Speller skips last word in testfile I use

The title speaks for itself, but here is a bit more in-depth explanation. While my check() function runs, it always skips the last word in whatever file it is checking out. The source code for my ...
0
votes
1answer
12 views

My load function is licking memory

the program complies properly but when i use valgrind shows am leaking memory when I open the file in the FILE *file = fopen(dictionary, "r"); bool load(const char *dictionary) { // TODO ...
0
votes
1answer
23 views

CS50 Speller Not Free of Memory Errors

When I run check50 on my code, valgrind says: Conditional jump or move depends on uninitialised value(s): (file: dictionary.c, line: 34) 112 bytes in 2 blocks are still reachable in loss record 1 of 1:...
0
votes
2answers
32 views

Segmentation fault error in pset5

I did the speller and had some errors that I solved, but now I'm stuck and need help. I debug the load and hash (I know it's not ideal, but it works:)) Now I'm receiving the Segmentation fault error ...
0
votes
1answer
30 views

pset5 speller check50 error - code doens`t handle max length (45char)

i get this error from check50 and i can t figure out why...: :( handles max length (45-char) words expected "MISSPELLED WOR...", not "MISSPELLED WOR..." everything else is green (...
0
votes
1answer
23 views

speller - unload returns false …?

unload returns false and i am not sure why.... when i run Valgrind i get this: HEAP SUMMARY: ==7885== in use at exit: 608 bytes in 2 blocks ==7885== total heap usage: 143,096 allocs, 143,094 ...
0
votes
1answer
40 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
31 views

Pset5 Speller Issues with check and unload functions

I have been stuck on this pset for over a week now. I have already checked other answers to similar questions here but none have been helpful to me. Testing through check50 as well as the debugger I ...
0
votes
1answer
26 views

cs50 speller code complies and run also successfully. but it not qualifying for big board

:) dictionary.c and dictionary.h exist :) speller compiles :( qualifies for Big Board expected exit code 0, not 139 :| passes benchmarking can't check until a frown turns upside down how to fix this *...
0
votes
0answers
18 views

Pset5: Problem with loading multiple words with the same hash number

I am having problems with loading multiple words with the same hash code. The hash function I chose, from what I can understand, takes the ascii codes of all of the words in the dictionary, and ...
0
votes
0answers
34 views

CS50 pset5 Speller - Code Does Not Compile Due to Issue with Hash Table/Load Function

I've been working on Speller for a little while now, but I've run into a roadblock. I finished my first draft of speller and have been clearing up errors until this point. Here's my dictionary.c so ...
0
votes
1answer
22 views

CS50 Pset 5 Speller Can't Handle Substrings

For some reason, when I run check50 cs50/problems/2020/x/speller, it says that my code can't handle substrings, but everything else works. My code recognizes that there are 2 words in the dictionary, ...
0
votes
1answer
27 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
1answer
19 views

PSET5: Missing Words from Text and Memory Leaks

UPDATE: I just fixed the capitalized spell-checking errors. UPDATE 2: free didn't totally free the string "caterpillar". Look at image: My code seems to encounter a weird bug where it does ...
0
votes
1answer
22 views

pset5/speller Check produces a segfault if I introduce hash function

If I have a single bucket, the program runs seamlessly, however when I introduce the djb2 hash function as seen here the program produces a segfault. Here's my code with the hash function commented as ...
0
votes
1answer
27 views

I can't assign a node to a bucket in a hash table with with right assignment of pointer and word values

When I assign table[index3] = n; what happens is that the value of the word receives a memory address and I can't follow table[index]->next to achieve the old n->word; This shouldn't happen. // ...
0
votes
0answers
25 views

code can't handle substring property

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

the misspelled words are more than expected

misspelled words in my code is seemed to be 2678 while the correct number is 955 some words like "and", "but", "a", "an" my code regards them as misspelled ...
0
votes
1answer
40 views

CS50 Pset5 Speller

I am having problems with Pset 5 Speller. I believe, I'm nearly there, I can get all functions to run and compile successfully, however my outputs are not quite right. I have attached comments to make ...
0
votes
1answer
33 views

Pset5 Speller. Treating the letter 's' as a valid word when using large dictionary?

I'm very puzzled my program seems to work correctly apart from one thing, when I run speller with large dictionary, the letter "s" is treated as a correctly-spelled word. I ran a test using ...
0
votes
2answers
47 views

CS50 Speller returns all word as mispelled and I can't find any mistake in my code

I need help, I can't get around this problem set. I have searched everywhere and I think the code is equal to most of the other students... The problem is that the check function is returning true ...
0
votes
1answer
21 views

Pset5 Speller: Conditional Jump or move

I can´t find why valgrind is giving me this message. ** ==3087== Conditional jump or move depends on uninitialised value(s) Looks like you're trying to use a variable that might not have a value? Take ...
0
votes
1answer
25 views

pset5 speller “Could not load dictionaries/large” error

#include <ctype.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include "dictionary.h" #define ...
0
votes
1answer
45 views

Pset5, Speller, output the same as staff, but check50 still showing entirely errors

I'm stuck on Pset5, Speller. My code all compiles correctly, and when run on the Lala Land example, provides the same output as the staff solution (albeit mine runs more slowly). But, check50 still ...
0
votes
0answers
32 views

CS50 Speller valgrind issues and

I'm new to CS and could really use some help on the speller pset. I've got a basic outline that doesn't seem to seg fault, but I'm still having issues. It fails check50 in that: it doesn't handle ...
0
votes
2answers
43 views

Speller unload function

Hello i am trying for two days now to find my mistake and i just can't find it i would be happy if you help me out with it Here is my code: https://pastebin.com/7EGHUsET I think i have made mistake ...
0
votes
1answer
28 views

recursive function on speller causing a “conditional jump” error on valgrind?

I am trying to implement a recursive subfunction for speller. It works, but when I run check50, I'm told that there is a "Conditional jump or move depends on uninitialised value(s): (file: ...
0
votes
1answer
19 views

pset5 case sensitive check fail

:) dictionary.c, dictionary.h, and Makefile exist :) speller compiles :( handles most basic words properly expected "MISSPELLED WOR...", not "MISSPELLED WOR..." :) handles min ...
0
votes
1answer
47 views

I dont understand valgrind pset5

Error from valgrind $ valgrind ./speller texts/cat.txt ==1453== Memcheck, a memory error detector ==1453== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==1453== Using Valgrind-3.13....
3
votes
2answers
72 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
68 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
25 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
46 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
48 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
52 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
63 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
48 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
33 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
36 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
27 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
28 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
39 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
57 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
43 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 ...

1
2 3 4 5
23