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
1 answer
49 views

pset5 check fails possessives and substrings

Ok, so I'm stuck... I finally (hopefully?) got load to work correctly, ie no leaks or errors with valgrind, but now check is giving me a hard time. I only have 135 words misspelled; and it I fails ...
0 votes
1 answer
45 views

I am having a segmentation fault before my main code runs, but code will compile. pset 5 - speller

// Implements a dictionary's functionality #include "dictionary.h" // Represents a node in a hash table typedef struct node { char word[LENGTH + 1]; struct node *next; } node; // Number of ...
0 votes
1 answer
16 views

Speller works fine up until a certain point

My speller program has an issue where it will find what words are misspelled properly, but it won't give the data of the amount of words misspelled/ in the dictionary/ in text. Running Check50 shows ...
0 votes
1 answer
39 views

pset5 can't share a pointer from load() to check()

I've implemented check() and load() using tries. I have a pointer 'head' to the top of the dictionary trie (NB it's called root in the walkthrough) that I need to pass from load() to check() I ...
0 votes
1 answer
34 views

Pset5 load problem: Dictionary cannot be loaded

I run my code and it cannot load the dictionary. I'm not sure if the problem is with my code or the file location. Anybody knows why? Thanks in advance.
0 votes
1 answer
84 views

PSET5. Free a variable outside a loop. leaking memory

I've been stuck for days in the implementation of LOAD with a TRIE data structure. I think my code works (well it doesn't show seg faults) but I am getting a lot of memory leaks. I implemented the ...
0 votes
1 answer
41 views

speller returning a segmentation fault, unclear why

this is my dictionary.c implementation. I think the problem is speller since I've been printing my hash values from hash. I also have not yet implemented unload since I think I'm having some ...
1 vote
1 answer
435 views

My check function in speller isn't working

I have implemented everything else but this check function when I try to test it it seems like the the check function isn't working, because the no. of misspelled words is the same as the no. in text.....
0 votes
1 answer
63 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
1 answer
66 views

PSET 5 Speller Compiles, But Completely Wrong Output

I spent the last few hours trying to come up with a solution and trawled through questions on this forum but I still can't figure out why my check function is not working out properly. For some reason ...
0 votes
1 answer
115 views

Speller: valgrind giving me segmentation fault but I can't see what's wrong with my code

I implemented speller and valgrind gives me a segmentation fault, but I just can't find the bug in my code. Please help :( Thanks a lot in advance. #include <stdbool.h> #include <stdlib.h>...
0 votes
1 answer
26 views

Why am I able to insert an element into a hash tree via Main() but not via a function call?

I'm fairly certain this has something to do with pointers and the function using copies instead, but I'm not sure how...because I've inserted the pointer as a parameter for create(); #include <...
0 votes
1 answer
64 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
1 answer
71 views

Pset5 Load function memory leak

Valgrind tells me I have a leak with malloc'ed node below. However, when I try to free it (free(n);) at the bottom of my code, outside the while loop, the program won't run (it doesn't pass check50 ...
0 votes
1 answer
535 views

pointer disappeared after passing to some functions (even with malloc)

I created a test.c for testing purpose. My problem is that I created a pointer at the bottom Main. Main will call load() to read input from a dictionary and insert the words in a inputfile into a ...
0 votes
1 answer
45 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 ...
0 votes
2 answers
280 views

pset5 Speller Unload Method, not sure where Im going wrong

I'm having issues with Unload at the moment, I am getting Seg error. I am moving tho the code with GDB and error occurs on a Null check i am doing in a while Loop. I am basically moving my transit ...
0 votes
1 answer
119 views

Pset 5 (speller): Problem with compiling due to 'declaration shadows a variable in the global scope;

I am using the trie structure for doing the pset5 speller. However, my program can't compile due to 'redefinition of node' in 'typedef struct node', and 'declaration shadows a variable in the global ...
0 votes
1 answer
70 views

Segmentation fault in pset5/speller while linking newNode with the linked list

I have been trying to resolve errors in my speller "load function". I have been able to resolve a couple of them except this one. Debug50 reveals that while creating a link between new Node and the ...
0 votes
2 answers
30 views

freeing temporary node in functions

how to free the temporary pointer, one creates during the check function? valgrind shows error on that particular statement tried freeing it only when it has reached null, i.e., transverse over all ...
0 votes
1 answer
111 views

cs50 pset5 hashtable check, misspelled more than expected

i have been working on the check for many days and not able to find why the misspelled word is more than stuff solution. Rest of the programs looks ok, and i used debug50 ,there is not too much clue. ...
0 votes
1 answer
87 views

Speller - Program has memory errors, but Valgrind claims all heap blocks were freed

:( program is free of memory errors | pset5 Speller I have invalid reads at lines 148 and 153 of my code (commented out below): bool unload(void) { // CS50 for (int i = 0; i < 26; i++)...
0 votes
1 answer
265 views

PSET5: Code works but doesn't qualify for big board?

Whenever I run this code, it works, but then when I use check50 it says that it doesn't qualify because it timed out while waiting for my program to exit. https://cs50.me/checks/...
0 votes
1 answer
64 views

Pset5 problem with load function : Keeps getting segmentation fault

I have been working on pset5 and i keep getting segmentation fault while trying to implement 'load' function. I cannot really see where is the problem. Any help will be really appreciated! Here's my ...
1 vote
1 answer
58 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
2 answers
98 views

PSET 5 Speller Check50 Problem

I think I have done everything you're supposed to do in PSET5 Speller. when I manually check the outputs of my code, it works perfectly well. It matches the staff solutions one to one. Yet Check50 ...
0 votes
2 answers
80 views

PSET5 Speller Trie Errors

So far, all other methods except check have already been implemented properly in my code. The problem with check is that it only returns true a lot fewer times than expected, which means that most ...
1 vote
1 answer
72 views

Using gdb for load function in speller

I am trying to figure out if all my words of the dictionary are uploaded in my declared node* hashtable[100]but when I am using gdb its just giving me the hexadecimal address of the nodes, be it a ...
0 votes
1 answer
56 views

Does anyone know how to fix this problem?

this error is in every check50 test. Conditional jump or move depends on uninitialised value(s): (file: dictionary.c, line: 92) Conditional jump or move depends on uninitialised value(s): (file: ...
0 votes
1 answer
59 views

Segementation fault in speller.c/pset5

I am working on speller.c/pset5 and when my code I get a segmentation fault.Plse let me know where am going wrong. I had my hands over debug50 as well but I can't figure out what's wrong. Any ...
0 votes
1 answer
47 views

(Speller) Search Function returns each word given as false, And when i run Small Dictionary gives me Segmentation Fault

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

How does the "re-copy method" work?

So, in Zamyla's walkthrough, she says that for the "Re-Copy" method of vertical resizing, you have to go back to the start of the original row, and then repeat the horizontal resizing. I don't ...
0 votes
1 answer
488 views

Pset5 speller trie

There is a problem with my load function which i cannot wrap my head around. I can run speller however because of this one problem, my misspelled words is always more than the actual value. What is ...
0 votes
1 answer
118 views

All words not getting loaded in speller.c's dictionary

This is my load function: #ifndef N #define N 200 #endif #ifndef LENGTH #define LENGTH 45 #endif #ifndef LL_LENGTH #define LL_LENGTH 1000 #endif typedef struct node { char word[LENGTH+1]; ...
0 votes
1 answer
198 views

Pset5 Memory leak and errors in valgrind

I have been beating my head against a wall trying to solve my issues on my own, but I have gotten no where. I have two issues: 1) I have a small memory leak of 568 bytes in 1 block. My unload function ...
0 votes
1 answer
757 views

correct plates.py passes all test_plates checks: expected exit code 0, not 2

On pset 5, I am getting this error from check50: :( correct plates.py passes all test_plates checks expected exit code 0, not 2 I am confused because my plates.py does pass all test_plates checks:...
0 votes
1 answer
1k views

Speller seems to be working but fails check50. (PSET5)

so currently my speller seems to be working, it matches the staff solution with the austinpowers.txt (correctly identifies that 644 words have been misspelled & works when using a small dictionary ...
0 votes
1 answer
613 views

pset 5 dictionary problems

I am having problems with pset 5. Honestly so far I have never had such a huge problems with a pset. I watched every video, read many questions and answers on stack exchange and wrote some code, which ...
0 votes
1 answer
21 views

Clang error when compiling (Pset 5)

I tried googling this but I couldn't find (or understand) much. I'm receiving the following error when I go to make dictionary: Here is my code for the load portion:
0 votes
1 answer
96 views

PSET5 : My program outputs wrong number of misspelled words

#define MAXH 145709 int total_words = 0; typedef struct node { char word[LENGTH + 1]; struct node* next; }node; node *hashtable[MAXH]; // djb2 by Dan Bernstein unsigned long hash(unsigned ...
0 votes
1 answer
75 views

pset5/speller incorrectly identifies correctly spelled words

I do apologise for the unspecific question, however I have been slaving away at this problem set for almost two weeks and have only just managed to get code that compiles. I have reached my wits end. ...
0 votes
1 answer
12 views

Code for pset5 compiles, but produces no OUTPUT. Seems like it is stuck in infinite loop

Description of Problem: Hey guys, so my code is outputting only MISSPELLED WORDS and then it apparently gets stuck in an infinite loop. So that I have to type ctrl + C to be able to type anything in ...
0 votes
1 answer
52 views

pset5 speller IDE and check50 show different outputs even though theyare run with the same code

When I run my speller code, it works perfectly fine in the IDE. However, after seeing check50, the output appears to be the following Anyone knows why this happens and how to fix it?
0 votes
1 answer
77 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
1 answer
96 views

Stuck on Pset5: segmentation fault. Debug?

I am completely stuck at pset5, and I don't know how to move on. I've tried to write code for all the four functions, but I strongly doubt that it is any good. It does compile, but 'speller.c' does ...
0 votes
2 answers
72 views

Exiting nested loops

I started off pset5 with a really simple hash function, where words are indexed according to their first letter, so a would be 0, b = 1 etc. Then I insert a piece of code into the load function, which ...
0 votes
1 answer
93 views

pset5 spellcheck, problem with load

Could someone please review this code as I am not sure why am I getting segmentation fault while trying to use ' in words in a dictionary. I am attaching the code of my load function. //////////////...
0 votes
1 answer
752 views

Program is free of memory errors, valgrind tests failed - pset5 speller

I'm am getting this error - program is free of memory errors, valgrind tests failed; see log for more information. I have tried so many things but I keep getting more errors. Here is my code: // ...
0 votes
1 answer
71 views

Check50 error specification?

So :) dictionary.c, dictionary.h, Makefile exist :( speller compiles \ expected output, not standard error of "dictionary.o: In function `check':\n/va..." The code is working (not as fast ...
0 votes
1 answer
78 views

Segfault on unload. Pset5 Speller

Just got my speller working. Except for the unload func. I feel that idea is right, but maybe the implementation is wrong. Words are not that long, so i figured that recursive solution wouldn't result ...

1
2 3 4 5
26