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

Is it possible to store the dictionary in an array?

I'm having some trouble in implementing load(). I thought I should make a trie, but could not understand how to. Then I thought I'd make a hash table, but I had no idea how to. The only way I can ...
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
202 views

PSET 5 speller.c check() function not working properly

bool check(const char* word) { char p[strlen(word)]; //get length strcpy(p, word); for(int i = 0; p[i]; i++) { p[i] = tolower(p[i]); //convert to lower } int hold=...
0
votes
1answer
604 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
23 views

changes to code in appliance not being applied

I am working on pset5 dictionary.c, I had it working and now it is not. I have been tinkering with the code but every time I save dictionary.c and then execute make dictionary.c, the response is "...
0
votes
1answer
117 views

Why does this PSET 5 Load function segfault?

typedef struct node { char word[LENGTH+1]; struct node* next; }node; node *bucket[65530]={NULL}; unsigned int count=0; bool load(const char* dictionary) { FILE* inptr = fopen(dictionary, "r"...
0
votes
1answer
152 views

pset5: dictionary loads, then seg fault in load

I've tested my load function with both large and small dictionaries, and I get the same problem for each one - it loads the dictionary completely (I've checked with gdb) but then after the entire ...
0
votes
1answer
264 views

PSET5: Massive leak memory detected when using Valgrind, “Conditional jump or move depends on uninitialised value(s)”

Before starting explaining my issue, I know there are threads talking about Conditional jump or move depends on uninitialised value(s) errors prompted after executing Valgrind but unfortunately, none ...
0
votes
1answer
3k views

speller unload pset5

Getting a double free error with gdb and valgrind points to my unload function as the cause in particular this part cursor = cursor->next; but I am not sure what's wrong with it. From what I can ...
0
votes
1answer
604 views

pset5 load speller.c, seg fault with gdb

Changing this question to be specific. My load function seems to run past the end of the cs50 small dictionary to give a segmentation fault after it works for cat and caterpillar. I can see that cat ...
0
votes
1answer
110 views

pset5 Aborted (core Dumped)

I have been trying to debug this for over 2 days now. Can't seem to locate the reason why there's a segmentation fault. Running this returns a bunch of misspelled words plus an error message - ...
0
votes
0answers
135 views

speller.c can't load large but can load test dictionaries

I know this is a commonly encountered issue with PSET5 and I have trawled all of the answers however none have helped me. My code passes check50 and valgrind result is that there are no leaks. Speller....
0
votes
1answer
386 views

Speller check keeps returning all mispelled words

I have looked over a bunch of posts on speller.c load but I cannot figure out what I am doing wrong here. My load function seems to be working well as a linked list. My check function keeps ...
0
votes
1answer
141 views

Segfault in check

I just moved on to pset5 and am finding a little difficulty. I believe I have implemented the correct code for dictionary.c but having searched through, I am getting a set fault during check. ...
0
votes
1answer
499 views

pset5 load doesn't compile

I am working on pset5 load but it doesn't compile. Could you have a look at my code? /** * Loads dictionary into memory. Returns true if successful else false. */ bool load(const char* dictionary) ...
0
votes
0answers
159 views

pset5 load/check: seem to be inadvertently freeing my hashtable

I think I've implemented load in a (mostly) correct way. For the most part it seems to be sorting and loading into the hashtable correctly but I'm not sure. The problem I'm running into is that I ...
0
votes
1answer
321 views

pset5 speller doesn't handle possesive and substrings properly

I got the following error while checking my pset5. :( handles possessives properly \ expected output, but not "\nMISSPELLED WORDS\n\n\nWORDS MISSPELLE..." :( handles substrings properly \ ...
0
votes
0answers
40 views

Strcopy pset5 segfault

I get this seg fault in the strcpy line when I debug with gdb. int wordlen = strlen(word)+1; char worda[wordlen]; strcpy(worda,word); I tried with char* but even then it wasnt working. Full code ...
0
votes
2answers
243 views

pset5 - check - possessives and substrings

I have all the memory leaks taken care of. Valgrind is showing no errors. My trie structure seems to work fine. The last part I need to do before I claim victory on this pset is to figure out exactly ...
0
votes
0answers
61 views

speller isn't running and I don't know if stuck or taking forever to even shoot error!

it's taking forever and I have no clue if there's a logic fail since I have run my own local program using tries to implement check using a few user entered words and then looking for the word which ...
0
votes
1answer
306 views

using root and current nodes in check when not declared until load

So i have used a trie structure for this pset. And i have declared my struct node in the load section as well as root and current which are nodes. I've written my code for check but I need to access ...
0
votes
2answers
58 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
32 views

Valgrind is saying strange things

I have implemented a trie whose leaf nodes branch off into linked lists that contain possible word endings, because I wanted to see if this would take less time to load. It does take less time to ...
0
votes
1answer
146 views

pset5 dictionary.c not working

In my dictionary.c file, I declared my own function called trieNavigate(), whose code is below. I use it for loading and for checking, and so it returns a bool and accepts 3 parameters: a char (that ...
0
votes
2answers
302 views

Invalid read/write errors in pset5

I have been trying to create a trie for storing my dictionary, and the code looks like it ought to work. However, when I run Valgrind on it, I get a number of read/write errors (mostly of size 4). In ...
0
votes
1answer
100 views

Pset5 Load, special characters

I have a doubt here, In pset5 when implementing load function, do I have to load in any special characters beside the new line one?('\n') And how can I check the correctness of my function?
0
votes
1answer
448 views

Pset5, speller 'could not open text'

So I wrote my load function and everything looks good, so I had it return true so I could move on and test other parts of the program. My problem is that speller.c won't load my text. I made a custom ...
0
votes
1answer
246 views

dictionary.c spell checker not working correctly

I have spent a lot of time trying to fix my check() function but I can't figure out where it is going wrong. By using printf(), it seems that the passed in word sometimes does not match with the word ...
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
184 views

No such file or directory in pset5

I am having issues with pset5. I followed the write up and tried to make the code but i imediately get no such file or directory as a reply. Using ls shows all the files in the directory. So i don't ...
0
votes
2answers
393 views

pset5 valgrind not happy with load (also, using malloc vs calloc on trie)

First, valgrind flags the file pointer at the fopen call, and also the malloc call to the root pointer. It designates both still reachable in loss record. Second, since for pset5 I check for an end ...
0
votes
0answers
55 views

pset 5 what am i missing

Im having trouble with the syntax and language for pset5, its driving me nutz. Say I have the word BAT:- OK so I have a root node. I check the root node to see if index 1 ( position 2 for the letter ...
0
votes
1answer
277 views

PSET5 load function incomplete large dictionary load (Segmentation Fault)

I've tested my code extensively and it successfully loads the dictionary to the chained hashtable with both the small dictionary and with a subsection of the large dictionary, but when I try to load ...
0
votes
1answer
157 views

Recursion doesn't work in pset5

Cannot work void freenode(node* in) { int children = 0; int save = 0; for (int i = 0; i < 27; i++) { if (in->children[i] == NULL) { children += 1; } else if (in->...
0
votes
0answers
359 views

PSET5 Speller: trouble with mispellings and tolower()

I am very close to getting my dictionary to word correctly, but I am having a small hiccup in my check function. In order to compare the word given in the check function to the dictionary, I first ...
0
votes
1answer
264 views

Pset5 dictionary.c is not producing correct output

I've implemented my load and check functions using tries. The program works fine and produces the output, but when I compared it against the output from staff's implementation, I found out that there ...
0
votes
1answer
726 views

pset5 trie load function killed with large dictionary

This has been bugging me for weeks. The program seems to run OK with small dictionaries, but gets killed with medium size - after around 95,000 words - it varies. LETTERS is set to 27. Any help would ...
0
votes
2answers
49 views

Returned of Segmentation Fault

I've declared a trie in the .h file with typedef struct node { bool is_word; struct node* children[27]; }node; and also declared node* root; Above the .c file. I've always receive a ...
0
votes
1answer
102 views

where can i get ppt of Zamyla's explanation in pset5

I didn't find anywhere to get that, I just want to get the ppt of zamyla's ppt in pset5, it help me to walkthrough the problems.
0
votes
2answers
71 views

pset5 : segmentation error when assigning a pointer to another one

In the load function, there is line where I'm assigning a pointer to another. Here is a snippet of the code used // Declaration node *header[26]; /* some code */ // Here is ...
0
votes
1answer
566 views

pset5 check50 error

I finished pset5 dictionary's implementation, seems working fine in the appliance but after running check50 on it, it shows following error:jharvard@ubuntu:~/Dropbox/pset5$ check50 2014.fall.pset5....
0
votes
1answer
71 views

How do I pass back the location of my loaded dictionary?

I have (hopefully) loaded the dictionary correctly, but I'm not clear on how to identify its location in memory without changing the declaration of the load function? More concretely, in my code for ...
0
votes
0answers
91 views

pset5 running staff implementation problem

recently i have taken a break from cs50, life got in the way, so I am sure I am missing something really simple......problem is running the staff solution for pset5. I typed in the command as per the ...
0
votes
1answer
87 views

Misspellings fails on substrings

I keep getting the error in check50 for substrings (https://sandbox.cs50.net/checks/ea6c780875d64b8cbf106c31f2f224a5). I have ran examples using test dictionaries and text and can't duplicate the ...
0
votes
1answer
925 views

pset5 dictionary: Misspellings differ when different hash functions used

I've been trying to figure this out and I really need help. When I run speller with a text file against the large dictionary, my code doesn't catch all the misspellings that are supposed to be in the ...
0
votes
1answer
97 views

End of file not found, why?

Help! i'm completely stuck is this code. After using a lot of gdb, i found out that when the end of file is reached the for loop (for(letter = fgetc(inptr); letter != '\n'; letter =fgetc(inptr)) //...
0
votes
1answer
259 views

Why won't my recover program read card.raw?

For some reason my program is not wanting to open card.raw. I have tried rearranging variables and I just don't see where I am going wrong. Any help would be appreciated! uint8_t buffer[512]; char ...
0
votes
1answer
1k views

Why won't speller load large dictionary in pset5?

In pset5, Speller won't load the large dictionary. Per the pset instructions, I seem not to have implemented my dictionary.c properly. Below are the beginning of my dictionary.c load section, and ...
0
votes
1answer
895 views

Conditional jump or moves depends on uninitialized values

I am getting the following valerind error. ==9649== Conditional jump or move depends on uninitialised value(s) ==9649== at 0x80493AD: check (dictionary.c:152) ==9649== by 0x8048A6D: main (...
0
votes
1answer
383 views

pset 5 valgrind memory leaks

So I am having trouble figuring out how to get rid of this memory leak. The leak is related (I believe) to the const char *'s in the n value of my nodes in the linked list. Here is the valgrind ...