Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 4847

speller.c is one of the files that make up Problem Set 5, but it is already written by CS50 Staff and you may not alter it! Instead, you must implement your solution by altering three other component files: dictionary.c, dictionary.h, and Makefile.

3 votes
Accepted

PSET5 - SPELLER - CODE COMPILES BUT FAILS CHECK50

Time for a little tough love here. From time to time, new programmers in this class are under the incorrect impression that getting a program to compile means success. It doesn't. Just because a prog …
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

pset5 speller - check functions seems to only return false?

Hmmm... This looks suspicious: // if there is no words at the position hash_code in the table if (table[hash_code] == NULL) { new_word = table[hash_code]; } Shouldn't this b …
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

Week 5: Speller. Hash function segmentation fault

I suspect that it is failing anytime it tries to hash a word with only one letter. Look carefully at the if statement: if (sizeof(word) < 2) What, exactly, is word? unsigned int hash(const char *word …
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

pset5 - seg fault when using large dictionaries or texts

Take a close look at the hash function. What happens if a word contains a non-alpha, such as an apostrophe? What values are returned? Try inserting this into your hash function to diagnose: printf("S …
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

PSET 5 speller fails when solving a memory issue

I'm not really clear on exactly what you're doing. If you're compiling it one way with the code commented out and another way with it not commented out, while the next, identical code block is presen …
Cliff B's user avatar
  • 69.3k
0 votes
Accepted

HELP! Speller segfault

Interesting problem. ;-) I'll point you in the right direction with a couple of questions. Which line is triggering the seg fault? What word is being processed when it seg faults? What is the value …
Cliff B's user avatar
  • 69.3k
1 vote

Pset5 Speller - Weird Load Function Bug (Edited w/ Code)

I suspect that this problem exists with each and every linked list that the table[] elements point to. (i.e., if the hash value is the first letter of each word, the first word in the dictionary file …
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

Speller Segmentation Fault Even After Freeing Malloc'd Nodes

I see a couple related issues. Let's look at the while loop in load(). char *word = malloc(46 * sizeof(char)); while(fscanf(dict, "%s", word) != EOF) { fscanf(dict, "%s", word); node *tmp = m …
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

Pset 5: Speller - Double free or corruption (fasttop) error

Let's look carefully at this one. First, one has to figure out where the error occurs. Valgrind shows it to be line 148 in unload. node *tmp = table[i]->next; Since this isn't a free() call …
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

Everything is correct in my Check50 but in program I have other ERRORS - PSET05 Speller

Valgrind is catching something that check50 doesn't look for. There is an issue with your hash function. It can't deal with one-letter words like "a". Consider that when the word is 1 letter long, wor …
Cliff B's user avatar
  • 69.3k
2 votes
Accepted

PSET5 Speller - Problem with Check Function

The most obvious problem is the use of the pointer headPointer. The code updates this pointer to point at the new node just added. The problem with that is that table[] will never get updated, so the …
Cliff B's user avatar
  • 69.3k
0 votes
Accepted

Pset5 speller segmentation fault when loading

Hmmm, help50 wasn't very helpful. The problem sorta lies with line 94, but not really. All that valgrind and help50 is telling you is that the problem memory was allocated on line 94. That gives you …
Cliff B's user avatar
  • 69.3k
0 votes
Accepted

PSET5 Speller case conversions

I see a number of issues here. Let's go through them in order. First, look at the for loop: for (int i=0; i < N; i++) { int w = tolower(word[i]) - 'a'; } What are you trying to accomplish here? This …
Cliff B's user avatar
  • 69.3k
0 votes
Accepted

PSET 5 Speller Issues with Check

[EDIT - previous answer totally unrelated to the problem.] Now that I have the full code to test, the problem became quickly obvious. The full code produces a segmentation fault when executed. This ca …
Cliff B's user avatar
  • 69.3k
0 votes
Accepted

Pset 5 Speller fscanf returning 0

The problem is that this code is executing the fscanf and processing whatever is read before it checks for EOF. There are several subtleties that are interacting here, leading to your result. First, t …
Cliff B's user avatar
  • 69.3k

1
2 3 4 5
23
15 30 50 per page