Skip to main content

Questions tagged [hash-table]

Filter by
Sorted by
Tagged with
0 votes
1 answer
298 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 ...
bobthebuilder's user avatar
0 votes
1 answer
528 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 ...
Matt R.'s user avatar
0 votes
1 answer
50 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 ...
Ruben Alias's user avatar
0 votes
1 answer
15 views

I can't reproduce a behavior to the hash table and the first node

1st. In dictionary.c the line: node *table[N]; declares an array of pointers or an array of nodes? 2nd. When I code: table[index] = n; table receive a value for ->word and ->next? or just ...
Maurício Mota's user avatar
0 votes
1 answer
69 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. // ...
Maurício Mota's user avatar
0 votes
1 answer
257 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 ...
Ciaran Egan's user avatar
0 votes
1 answer
75 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 ...
jaxk's user avatar
  • 3
0 votes
1 answer
173 views

PSET5 Compiling issue

So I finally finished my code and received 20 errors when attempting to compile, after my first attempt fixing the errors I tried again and received 15 errors, once more and received 17, and now am ...
ayeeitsalpha's user avatar
2 votes
1 answer
7k views

CS50 good hash function for PSET5 Speller

I was looking up different hash functions and was getting really confused following what the code was doing. I stumbled upon this hash function: int hash(const char * str) { int hash = 401; ...
ayeeitsalpha's user avatar
0 votes
1 answer
79 views

PSET 5 My hash table doesn't seem to be storing correctly

When I load the dictionary, I add the words to the hash table, by calling the hash function to calculate the bucket ID, then add hash function to actually insert it into the list. Inside the addhash ...
Jamie Walker's user avatar
0 votes
1 answer
69 views

Pset5 Speller: every word in text reported as misspelled

Code compiles, dictionary loads and unloads, word count works and hash function seems to work. However, the results show that every word in the text is misspelled. I’ve spent 3 weeks tweaking the code ...
Dustin Sanders's user avatar
0 votes
1 answer
61 views

Speller.c doesn't work

I've spent pretty much time trying to solve a speller and got really stuck, don't know what's wrong with my code. It compiles but check50 says it's totally incorrect. I would be grateful if you could ...
HackeR73's user avatar
1 vote
2 answers
7k 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; ...
Shrey Tripathi's user avatar
1 vote
1 answer
447 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.....
Ojou Nii's user avatar
  • 731
0 votes
1 answer
54 views

in speller load() struggling to understand if populating dictionary correctly and how to check hashtable

I am building my load() function and I'm wondering if I'm building it so that it is indeed storing the dictionary words correctly. I tried printing both: printf("%s\n", new_node->word); //...
Katie Melosto's user avatar
0 votes
1 answer
87 views

speller double free or corruption hashtable

I'm getting a "double free or corruption" error when running this code. I don't know in which function the error is. I get the error after the code has run through check, before it gets to the unload ...
Kevin's user avatar
  • 1
0 votes
2 answers
195 views

Speller (Hash) not handling substrings properly

All tests seem to pass okay apart from the substrings test.The results of this test are : :( handles substrings properly expected "MISSPELLED WOR...", not "MISSPELLED WOR..." Log running ./...
Chesny's user avatar
  • 27
0 votes
1 answer
26 views

Pset4: dictionaries with hashtable -- every word is misspelled

I'm getting every word is misspelled when I run ./speller dictionaries/large texts/pneumonoultramicroscopicsilicovolcanoconiosis.txt When I run help50: Sorry, help50 does not yet know how to help ...
Pexan's user avatar
  • 19
0 votes
1 answer
54 views

do not understand why check function checks new word against dictionary

I am trying to implement the check function of Speller in CS50. The code below may or may not work. But the thing that gets me is that I don't understand the bit : if strcasecmp(cursor-> word, ...
stephen Ong's user avatar
-1 votes
1 answer
3k views

I keep getting the message that 'non-ASCII characters are not allowed outside of literals and identifiers.'

I keep getting the message that 'non-ASCII characters are not allowed outside of literals and identifiers.' I get this message when I compile and it is at the strcpy section. Any help gratefully ...
stephen Ong's user avatar
0 votes
1 answer
160 views

CS50 [Speller_hashtable] my hashtable is weird!

After debugging for a long long time, it turned out that my hashtable must have some problem. Therefore, to find out where the problem is, I put this line of code after I insert a word in the ...
AvisTai's user avatar
0 votes
1 answer
154 views

PSET4 (Speller) malloc and calloc usage

After getting my code to work, i looked if there were any memory leaks using valgrind. It found no memory leaks, however it returned these two errors: ==7109== Conditional jump or move depends on ...
tomas-silveira's user avatar
0 votes
1 answer
524 views

Speller (hash) memory leak?

The program seems fine to me (other than this, it runs as intended), when I run valgrind, it says: ==5101== Memcheck, a memory error detector ==5101== Copyright (C) 2002-2017, and GNU GPL'd, by ...
Amit Rajaraman's user avatar
0 votes
1 answer
69 views

I can't figure out what's wrong with my speller (hash) code

When I try to run it, it says that there are no words in the dictionary so there's probably something wrong with the load function. My load code: // Loads dictionary into memory, returning true if ...
Amit Rajaraman's user avatar
0 votes
1 answer
94 views

Speller(hashtable) VALGRIND ERRORS!

i don't know or understand through val grind where and what i'm doing wrong. Except for memory errors my code outputs as correct in check50. my code // Implements a dictionary's functionality #...
Rahat Muneeb's user avatar
0 votes
2 answers
563 views

PSET4 Speller(hashtable) cs50 2019 HELP!

Can somebody please help me whenever i execute check50 on my code i get this :( handles most basic words properly expected "MISSPELLED WORD...", not "MISSPELLED WORD..." :( handles min length (1-...
Rahat Muneeb's user avatar
0 votes
1 answer
326 views

PSET 4 - Speller: Every single word is misspelled

When I run the program, all words are considered misspelled. I can't figure out where the problem is. Can someone please help me? It also says that my program is free of memory errors - can't check ...
dino's user avatar
  • 3
10 votes
3 answers
1k views

pset4 speller - can't pass valgrind test - 32 bytes still reachable

Can't pass valgrind test on pset4 speller (hashtable). The speller works perfectly but, I'm getting this message from valgrind: ==3911== ==3911== HEAP SUMMARY: ==3911== in use at exit: 32 bytes ...
agraffe's user avatar
  • 101
0 votes
0 answers
164 views

Speller - Valgrind - Blocks Are Still Reachable

Valgrind indicates 32 bytes in 1 block still reachable. My speller seems to work in all other respects based on my own testing and Check50 (except final memory check). Since I do not see any valgrind ...
mdisandro2's user avatar
0 votes
1 answer
293 views

CS50 pset 4 speller - qualifies for bigboard

My code qualifies with check50, valgrind and style 50. But when I want to submit it to big board it says "timed out while waiting for program to exit" Here's my dictionary.c - // Implements a ...
Intiser Rajoan Parash's user avatar
0 votes
1 answer
536 views

PSET5 "Linker Command Failed with Exit Code 1"

I've been working on speller (implementing a hashtable) for quite a while now and I'm stuck...my code compiles but I'm assuming there's a run-time error. I'm not sure what to make of my error message, ...
Sean Cheng's user avatar
0 votes
2 answers
564 views

pset4 speller all words are misspelled

I realize that many people have asked this question before but I didn't find my answer in any of them. Or maybe I'm just too stupid to see it. Anyways my code seems to work except that all the words ...
John Doe's user avatar
0 votes
1 answer
148 views

CS50 - Speller (Hashtable) - Misspelled all words

My program is misspelling all words in the texts. There is a problem somewhere in either load or check, but I just can't figure it out. Can you guys help me find the problems I am having in my program?...
HenryVo's user avatar
0 votes
1 answer
44 views

"check" function in pset4, problem with hashtable and pointers

I'm getting an pesky error when trying to compile my code. error: use of undeclared identifier 'hashtable' first = hashtable[i]; My code, per below, is an attemp to implement the check function ...
Victor's user avatar
  • 1
0 votes
2 answers
1k views

pset4 Speller hash table basics

After struggling with this pset for a while I decided to strip it down to its most basic form and try and understand the implementation of hash tables and linked lists by creating my own. To that end ...
borebot's user avatar
0 votes
2 answers
566 views

How can I debug my load() function in Speller?

So I have code that I feel as though should be working, but I'm having trouble checking my work. I wrote a function that I think loops through my table, but it only displays half of the data seemingly....
Colin Thrapp's user avatar
0 votes
1 answer
397 views

Speller 2019: dictionary could not be unloaded and the program identifies misspelled words wrongly

my code does not work so well because it could not unload the dictionary/large eventhough there are no leaks in memory. My programm does also identify the misspelled words wrongly. Just comment if ...
Tien Thang Dinh's user avatar
1 vote
1 answer
167 views

Pset5: Hashtable, cannot submit my code

I am unable to submit my code to test it against other cs50 students :) dictionary.c and dictionary.h exist :) speller compiles :( qualifies for Big Board expected exit code 0, not 139 How ...
user avatar
0 votes
1 answer
27 views

There seems to be some problem with loading words from a dictionary into a Hashtable, It compiles fine but does not give the expected output

Whenever i run the program it always displays number of words in dictionary as 26. When i try to debug using debug50 loading looks fine but when i debug the size part it display 0x0 against the next ...
user avatar
0 votes
1 answer
412 views

CS50 Speller (hash table) - Check returning 0 misspelled words

I'm looking for help with my (hash) code in check to properly handle misspelled words with apostrophes and substrings: bool check(const char *word) { int len = strlen(word); char copy[len + 1]; ...
Leah's user avatar
  • 3
0 votes
1 answer
74 views

pset5 speller program doesn't display benchmarks

When I ran my code through the compiler, it displays all the misspelled word correctly as per the staff solution. However, the program does not end after displaying all the misspelled words and it ...
Prav Elan's user avatar
0 votes
1 answer
27 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 <...
Krishaan Khubchand's user avatar
0 votes
1 answer
142 views

pset5 load null pointer issue

Working through the load portion of pset5. Everything compiles, but when I run valgrind it looks as if nothing is actually loading in, with the error of "null pointer passed as argument 1, which is ...
Jake 's user avatar
  • 37
0 votes
1 answer
136 views

HashTable full of single value

I think the problem is in my load function. I am able to successfully create a hash for each word, and I can call my createNode and insertNode functions to such a degree that I create a full hashtable ...
wlh's user avatar
  • 132
0 votes
1 answer
124 views

Two hash table questions

I am working through SPELLER and have a few questions. When I create a new node node *newptr = malloc(sizeof(node)); do I need to say newptr1, newptr2, newptr3 and if so what is the best way of doing ...
ndjustin20's user avatar
0 votes
1 answer
732 views

Struggling with hash table! Pset5

I've been trying to fix this bug for the past couple of days, but it seems this one I really can't figure out on my own. Hope you guys can help a bit. Here's the code for my load function in pset5. #...
Elkan Frank's user avatar
0 votes
0 answers
65 views

Printf prints newline character instead of string in Pset5

I'm working on the Speller program in Pset5. As always, i'm using a modular approach to construct all the required constituent functions one by one. However, something quite odd is happening in my ...
PvtWitt's user avatar
0 votes
1 answer
564 views

Segmentation Fault on Hashtable

PLease Someone help me I was trying to implement a hash table that stores the word of English language for pset 5. So to be in brief, I used an array of linked list ( Chaining ) , I haven't made the ...
amethyst stan's user avatar
0 votes
1 answer
320 views

Speller(hashtable) flagging all words as misspelled

I've exhausted all my options which is why I'm making this post. When I simply run the program it prints every word as misspelled. The problem itself probably lies in load or check. Running the ...
zmmadewell's user avatar
0 votes
1 answer
140 views

pset5 speller (hash table) - when using large dictionary program prints "mispelled words" and has to be closed with ctrl c

When running speller with the small dictionary and ralph.txt as the text, my program correctly outputs the misspelled words and outputs the statistics (i.e. time in load, number of words in dictionary ...
Jennah's user avatar
  • 5