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.
1,172
questions
0
votes
1answer
8 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 ...
0
votes
1answer
181 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
1answer
106 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
1answer
18 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 ...
0
votes
1answer
201 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/...
1
vote
1answer
257 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
1answer
25 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
51 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
1answer
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
1answer
42 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
1answer
47 views
PSET5 Dictionary code compiles but doesn't run as expected
I have been sitting on this pset for weeks but i have not figured what i wrote wrongly.. I implement the solution to this problem using a trie, however i think my trie is not properly linked/connected....
1
vote
1answer
26 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
68 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 ...
0
votes
1answer
60 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
1answer
124 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
1answer
19 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
481 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
1answer
104 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
1answer
14 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 ...
0
votes
1answer
61 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
2answers
55 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
1answer
88 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
1answer
65 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
1answer
85 views
singly-linked list issues
this is not directly related to the problem set, but maybe somebody can help me out nevertheless. I'm trying to understand the singly-linked list and so I've attempted to write one on my own, based on ...
0
votes
2answers
214 views
Help With Pset5 Unload (Valgrind issue)
I hope you are well. I am now on Pset5's unload function and have run into a blocker.
When I run valgrind on it, here's what happens:
http://pastebin.com/45XHAcPj
I cannot see what the issue is.
...
0
votes
1answer
281 views
PSET 5 Spell Checker - Error: Could not load dictionaries/large
I would be so grateful to anyone who can help me figure out this issue.
After finally getting my code to compile I was met with the following terminal error when attempting to run the program:
"...
0
votes
1answer
14 views
Pset 5 speller load function and word
I'm working on my load function to obtain the "word" from dictionary and I obtain one of the next message
dictionary.c:59:28: error: use of undeclared identifier 'word'; did you mean 'load'?
...
0
votes
1answer
16 views
a:hover and a:active tags not editable in html/css
I'm trying to make a homepage as per the pset5, and want to change the color and decoration of hyperlinks. The a:link and a:visited tags were editable, but not the other two. Here's my code for ...
0
votes
1answer
77 views
My speller only deals with one word, despite me setting a new node for each iteration in load
This is my code for load and check... The speller finds only one word in the text then returns all the others as misspelt. I have seen someone here struggling with the same problem, and his/her issue ...
0
votes
1answer
83 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
1answer
67 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
vote
1answer
62 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
1answer
46 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
1answer
59 views
Pset5 is missing from the web site
I just watched the Week 5 lecture and now I notice there is no pset5 accessible on the web site.
Do I miss something here?
I also notice that there is no Week 6 on the web site.
0
votes
1answer
602 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
1answer
80 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
1answer
84 views
PSET5 speller.c not getting properly graded
https://ide.cs50.io/gauraviit/ide50
This is link to my cs50 ide
I had submitted by cs50 pset5 solution but I'm getting 0 graded. when I ran the check that cs50 has given my code passes all the test ...
0
votes
1answer
53 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
2answers
23 views
Pset5 Speller,Check function isn't working as expected, strcasecmp always returns false
The problem is the word is found in loaded dictionary it's found but check function still returns false
i've been like 7 days in this problem someone helps please,
((I'm Trying to test code ./speller ...
0
votes
2answers
238 views
Seg fault in recover.c pset5
I don't know why it's showing seg fault.
Could anyone please tell me what I've done wrong?
#include<stdio.h>
#include<stdint.h>
#include<stdlib.h>
typedef uint8_t BYTE;
...
0
votes
1answer
341 views
dictionary check50 returns \ expected output, not standard error of “/opt/sandbox50/bin/run.sh: line 31: 102…”
My dictionary implementation appears to work as my program's output matches the staff exactly.
Check50 is giving me the error below for every check starting with handles most basic words
\ ...
0
votes
1answer
301 views
Submitting pset5 to the new CS50 2017 grade book
I had started pset5 before the introduction of the new course material for 2017 and the gradebook. The have finished the pset5 of 2016. My question is whether I can submit my pset5(2016) to the new ...
0
votes
1answer
119 views
PSET5: Unloading function doesn't work
I've decided to implement the trie data structure and got everything working except the unloading part. I've written another function for it and it isn't working. I think it only frees the first few ...
0
votes
1answer
272 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
1answer
82 views
Pset5 compile but report segmentation fault inside load
HELP!! I'm finally able to make my code compile without error. I know it won't guarantee it'll work, but at least I can move to the next step. :-)
When I run the code it gives me segmentation fault in ...
0
votes
1answer
577 views
pset5 dictionary c. trie please help Unload()
i ve been working struggling so much... please, a hint why i can make it work. I don t know how to return the result and make sure that the conditions are followed. here are my codes for unload :
...
0
votes
1answer
101 views
Trouble with Substrings in Check in Pset5
I have used a trie structure to implement my dictionary in pset5 and I believe my load() function is operating correctly, however I seem to be having trouble with checking substrings in the check() ...
0
votes
2answers
5k views
PSET5 Speller hash function
I have been working on the speller problem in pset5 for a while now, and I am not able to figure out the problem in my hash function:
unsigned int hash(const char* word)
{
int M = 1000000001;
...
0
votes
1answer
20 views
cs50 pset5 functions check load assistance required
I have reached an impasse with regards to this exercise.
I believe that I have written the load function and it works.
I also believe that the hash function works
I think the size function returns a ...
0
votes
1answer
452 views
Pset5. How to make speller code take less time?
//define node structure
typedef struct node
{
bool is_word;
struct node *children[27];
} node;
//pointer to the first element of trie
node *root;
//counts number of words
int words = 0;
//...