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

Help with check function (PSET5)

My check function is counting the right amount of words in dictionary and text, but it outputs words that are not misspelled. Here are all the functions of the problem, the arrays are used to locate ...
0
votes
0answers
13 views

Need help with check function, speller problem

When the program reaches this line of code: if (strcasecmp(seguido->word, word) == 0). It does nothing, it doesn't have an output or continues to the next iteration. Here are all the functions of ...
1
vote
1answer
26 views

Pset 5, Speller, What are the issues in my code(Check or load issues?)?

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

Speller still isn't running correctly

I rectified the earlier error in my code (putting dictionary within inverted commas). I also corrected my error in unload where the function would always return false instead of true. However, I ...
0
votes
1answer
15 views

pset5 - speller "double free detected" when I run check 50 but program does nothing during self tests

I am currently doing Speller. I have written all the functions and the program compiles but during self testing it is printing "misspelled words" and stays stuck at a blinking cursor. It ...
0
votes
1answer
18 views

pset5 unload + valgrind

I tried to solve problem with memory usage but did not figure out where is the problem. Dictionary unloads successfully but still issue with memory access exists. I think that problem with ...
0
votes
1answer
19 views

Getting a segmentation fault on cs50's speller (pset5)

I would love a bit of help on cs50's pset5 speller. The program does compile. However, when I run valgrind ./speller texts/cat.txt I get a segmentation fault . I think I am overlooking something but I ...
0
votes
2answers
12 views

Pset5 CHECK cursor returns NULL erroneously

I keep getting most, if not all, of the words in the text returned as misspelled. I tried debug50 with the small dictionary and cat text and found that the cursor in CHECK always returned NULL, so the ...
0
votes
1answer
21 views

problems in unload function-pset5

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

dictionary.c - pset5 segmentation fault

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

Problem Set 5 - Segmentation Fault

I am trying to overcome the segmentation fault on the following code, and I couldn't manage to solve the error. Segmentation fault occurs in the load() function, and after hours of debugging, I couldn'...
0
votes
0answers
18 views

CS50 Speller: valgrind test says that bytes are still reachable in 3 blocks

I'm currently at the CS50's pset5, and am working on the "Speller" problem. I managed to do all functions and don't have any compile or runtime errors. When using check50, though, I receive ...
0
votes
0answers
54 views

pset5 ; inheritance ; memory leakage

I have successfully completed the inheritance.c script, but there is something I do not understand, if anyone would be willing to help. inside free_family function, when handling the base case: if (p-&...
0
votes
0answers
22 views

My program is showing Segmentation Fault

I am working on pset5 speller. When I am running my program it is showing segmentation fault. And I am not quite sure why. Please look into it. here is my code: // Implements a dictionary's ...
0
votes
1answer
47 views

Where am I making a mistake?

I am solving problem set5, speller. My program is compiling correctly, but I am not sure exactly what the output is supposed to be. My program is not even getting approved from the check50. Here is ...
0
votes
1answer
23 views

pset5 speller all words are spelled wrong

new error: most words are seen as spelling error Here's my full code: (UPDATED) // Implements a dictionary's functionality #include <stdbool.h> #include <string.h> #include <stdio.h>...
0
votes
1answer
20 views

Pset 5 Speller Load Function Segmentation fault

When I run my load function there is a segmentation fault. It comes at line 80 in my code node* n = malloc(sizeof(node));. I am unsure of how to fix this error. Moreover, I changed my code many times ...
0
votes
1answer
22 views

Unload function pset5

I've completed the pset5 and got all the check50 marks correct, except the valgrind one. What is weird is that Valgrind also say that i've freed everything correctly. Here is the error message that I ...
0
votes
1answer
30 views

70-90 Extra Misspellings - Any ideas?

I did ask this on Ed Forums so my apologies if you're sick of seeing it - but I'm still so stuck!!! I get almost the right number of misspelled words on whatever text I use but it's off by the first ...
1
vote
1answer
28 views

Speller - unload is giving me 1000000 errors in valgrind

so I don't know what I should do with my unload function to make it work properly? Because valgrind isn't happy at all and it's giving 1000000 errors (literally). The load function works perfectly (I ...
1
vote
2answers
50 views

PSET 5 SPELLER - Passing Valgrind but not Check50

I am very close to solving this, my code is returning 0 errors from Valgrind when I run that on its own, but its not passing the memory errors parameter in check50, so I'm very confused. Any help ...
1
vote
1answer
51 views

PSET 5 Load and Hash seg fault

I've update the code somewhat. Mostly fixing my hash function so it will run properly with non alphabetical words. Three hours into this though and I still can't seem to figure it out. I know now it ...
1
vote
1answer
44 views

PSET 5 Load Function woes

Back with more questions about my code. 1) fscanf: When using fscanf do we need to iterate through what it is writing to the buffer to check for the null signifier so we can jump in and strcpy that ...
0
votes
1answer
75 views

Lab5 free_family function

I have created the below function to free memory allocated by the create_family. // Free `p` and all ancestors of `p`. void free_family(person *p) { // TODO: Handle base case if(p == NULL) ...
0
votes
1answer
27 views

Collatz Function Iteration

Guys help here I'm so lost as how to answer this question, I'm infact clueless...Find the two smallest different input numbers x,y (with 0<x<y), for which the COLLATZ algorithm takes equally ...
1
vote
1answer
39 views

Lecture 5 Linked Lists: What's going on under the hood?

Sheepishly I must admit I am having difficulty understanding how Linked Lists are implemented. Spent an hour and a half just on this part. The following partial code is from the lecture (comments ...
0
votes
1answer
14 views

pset5 - not sure where memory leak lies

I've looked through a few answers and I was unable to make this work. My code fails the last check since I'm getting "still reachable" errors. Help50 seems to think I'm doing something wrong ...
0
votes
1answer
29 views

Why won't my Speller correctly identify misspelled words?

See the code below. I initially had some segmentation fault issues, but now everything compiles OK and valgrind indicates no issues. However, running check50, the output indicates that my program isn'...
0
votes
2answers
38 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
1answer
35 views

speller identifies most words as mispelled

Despite memory problems to be fixed, my code compiles fine and runs but returns almost every word that it checks as mispelled. I have spent so long looking at all this now that I am worried it just ...
0
votes
1answer
61 views

PSET5 speller segmentation fault

Can anyone help with segmentation fault. I have tried running debug50 and aparently the fault hits at line "if (head -> next != NULL)" in the load function. Aparently "table" is ...
2
votes
1answer
31 views

What is the usage of creating DICTIONARY_H in pset5?

I cann't understand when to use the preprocessor directives as (ifndef, define ,etc.)? In dictionary.h, what is the importance of writing those statements? and regarding the reason that was mentioned ...
0
votes
0answers
21 views

PSET5: Memory Leak in unload

I am done with the code but valgrind tells my I still leak memory in my unload-function. I already checked if the code is working, and it does. With help50 I get the information that I leak 56B bytes ...
0
votes
1answer
21 views

Why are check50 and valgrind telling different things?

When I run help50 valgrind ./speller texts/lalaland/txt it returns ==1123== ==1123== HEAP SUMMARY: ==1123== in use at exit: 472 bytes in 1 blocks ==1123== total heap usage: 143,096 allocs, 143,...
0
votes
1answer
74 views

Speller not working! What's going on?

My function returns this: WORDS MISSPELLED: 375902 WORDS IN DICTIONARY: 143091 WORDS IN TEXT: 376904 TIME IN load: 0.02 TIME IN check: 1.20 TIME IN size: 0.00 TIME ...
0
votes
1answer
25 views

Check function pset5 speller

I've been stuck on this for hours, please help. bool check(const char *word) { char check_buffer[LENGTH + 1]; for(int i = 0; i < strlen(word); i++) { check_buffer[i] = word[i]; ...
0
votes
1answer
28 views

Valgrind says 8,013,096 bytes in 143,091 blocks are still reachable in loss record 1 of

Hi) I understand that something incorrect with unload function and that 143,091 blocks it's basically the number of words in the dictionary that was uploaded by the program and I didn't manage to ...
0
votes
2answers
51 views

PSET5 Speller Load function skips the words from the dictionary

Struggling with the load function in speller for second week now. What I found using debug50 and placing "printf" between different lines of code is that the fscanf reads every second word ...
0
votes
2answers
42 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
39 views

PSET 5: valgrind: memory marked as 'still reachable'

fortunately I finally made it through speller. The only thing remaining is a valgrind error: ==2226== HEAP SUMMARY: ==2226== in use at exit: 8,013,096 bytes in 143,091 blocks ==2226== total heap ...
0
votes
1answer
45 views

pset 5 - speller: Hash function gets stuck with strlen() and I don't know why. Furthermore I'm lacking memory

I have several problems with my speller code and debug50 wont help me. I sat in front of it for hours now. Just want to know, where to start. Have no clue. At first Debug50 gets stuck at strlen() in ...
0
votes
3answers
55 views

PSet 5 Speller: How can the program tell if the dictionary has been successfully freed?

I'm pretty sure I'm just being dumb, but I've been wracking my brain and I'm drawing a blank. I've completed 5/6 of the functions in Speller, but the unload function has me stumped- the description ...
0
votes
2answers
49 views

Speller.c, get correct result on my machine, wrong on check50

Good day, I am struggling with speller.c. When I run the program on my machine I get the correct result compared to the keys but then when I use check50 to check I get all wrong. I have narrowed the ...
0
votes
1answer
83 views

Output in Speller.c seems to match the staff solutions, but cannot seem to pass check50

This is what I happen to get when I run check50, which is weird, because when I do manual tests, I seem to match the keys. Other posts make me think this might be an issue of using the incorrect slug? ...
0
votes
1answer
133 views

lab 5 // issue when freeing family memory

Hi I have an issue with freeing the family memory in my code: when I run my code the issue seems to be from the free memory for the parents section but I am not sure what's wrong void free_family(...
0
votes
1answer
32 views

pset5 - speller - recursion

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

Pset5 - Speller - Seg fault

I'm getting a segmentation fault when running this. Valgrind reports no errors, but a leak of 1,080 bytes at two blocks, with 5 allocs and only 3 free'd. Below is my load function and below that are ...
1
vote
1answer
33 views

Pset 5 Output to file different from terminal output

I'm stuck on Speller... the code compiles and provides the same output as the staff solution when the output is redirected to a file, as instructed, to: $ ./speller texts/lalaland.txt > student.txt ...
0
votes
2answers
75 views

Pset5 - Speller - Valgrind error for malloc in load function

I get all test results correct except the Valgrind error as follows, does anyone know why is it so and share some insights please? thanks! running valgrind --show-leak-kinds=all --xml=yes --xml-file=/...
0
votes
1answer
24 views

Uninitialized values in PSET5

I've looked through all the various answers but I can't seem to figure out what the issue is... I understand that I can't reference values that may not be initialized but I don't understand how else ...

1
2 3 4 5
25