Questions tagged [pset6]

The problem set for Week 7

Filter by
Sorted by
Tagged with
0
votes
1answer
178 views

PSET6 Auto Grader

I submitted my solution to PSET6, but the autograder does not seem to evaluate the solution correctly. I have checked the solution using check50 and everything passed. I compared the staff solution ...
1
vote
0answers
115 views

Check50 seg. faulting on speller, locally works fine

I've been trying to fix this for days, sadly, it's almost impossible for me to try and figure out what's going on when my speller works perfectly fine locally. I tested running my program on every ...
0
votes
2answers
74 views

Extra file not used to grade my submitted problem set

I got all zeroes in the grader but my code passes check50 when one extra file I coded is included in the command line. I have a file called hashfunction.c that I included in the SRCS tag in Makefile ...
0
votes
1answer
768 views

load function does not load the dictionary

I have a question concerning my load function. I get the error that the dictionary does not load. Does anyone recognize the mistake? Thank you for helping. #include <stdbool.h> #include <...
0
votes
1answer
127 views

what is wrong with this sorting method in load function?

The word caterpillar is not getting loaded in the hashtable on index 2 next to cat when small dictionary is used , i have already written code for insertion in the beginning i.e cat is already loaded ...
0
votes
0answers
713 views

"linker command failed with exit code 1" and other errors when using make

I get multiple errors when I try to compile speller.c from pset6. I've tried switching to -std=gnu89 and I get the same thing. What is going on? jharvard@appliance (~/Dropbox/pset6): make clang -...
0
votes
1answer
256 views

pset6 load seg faulting when accessing malloc'd node

I need some guidance on where I'm going wrong here. GDB runs fine until I try to access the "next" property of a node to see if it's NULL. Am I just confusing how the node structure works? My ...
4
votes
2answers
266 views

How to access the hash table inside check function?

I have written the code for the load function that forms a hash table of the words in the dictionary , how to write the code for check as the hash table which I have made is local to the load ...
0
votes
1answer
116 views

Can I improve my new node initialization in load()?

Now, when creating a new node I use these lines to initialize them node* temp = malloc(sizeof(node)); // initialize node for(int i = 0; i < 27; i++) { temp->children[i] = NULL; } //if at ...
1
vote
1answer
1k views

char* text = (argc == 3) ? argv[2] : argv[1];

Could someone explain me what the line in the title actually does? Am I correct if argc is 3 char* text is argv[2] else char* text is argv[1] ? If so, how do the operators work in this ...
1
vote
1answer
141 views

In speller.c, when consuming the remainder of a word, why does the program iterate until EOF?

On pset6 when the program finds a word too long or a word with numbers it iterates over the file to find another word like this: while ((c = fgetc(fp)) != EOF && isalpha(c)); Why use EOF if ...
0
votes
1answer
93 views

Garbage values when creating new node

So, for my load function in pset6, I'm creating a new node for the current char if it isn't found in the children. node* node_cur = &root_node; loop iterate over chars in word { if(node_cur-...
1
vote
1answer
744 views

valgrind messages about "unititialised value(s)" - are they an issue?

My speller program functions fine, but when I run it in valgrind, I get a lot of messages saying Conditional jump or move depends on uninitialised value(s). Looking into this a little, I think this ...
3
votes
1answer
136 views

Is cs50.net/discuss open to students without a Harvard University ID?

In the pset6 specification, just after the last inline youtube video and the info about Valgrind, there is a link to cs50.net/discuss. When I click it, it redirects to the HUID/XID login screen. ...
1
vote
1answer
250 views

segfault while freeing memory in speller

I'm having an enormous problem implementing the unload function for the speller in pset6. Although it's not a well-polished algorithm I first wanted to make a quick design that allows me to take a ...
0
votes
1answer
100 views

Speller getting instant Segmentation Fault [closed]

I get a segmentation fault as soon as I run speller.c. Tried using gdb but the seg fault happens instantly so not sure what's causing it. Could someone maybe look over my code and give me some hints?
0
votes
1answer
453 views

Where are the dictionaries for speller?

When I run speller.c it says it could not load dictionary. I can't find the dictionaries anywhere in the appliance. Home directory only has jharvard in it and when I put gedit ~cs50/pset6/dictionaries/...
2
votes
1answer
3k views

Segmentation fault and "Address 0x30 is not stack'd, malloc'd or (recently) free'd" message in Valgrind

I have finished implementing pset6; however, I get a segmentation fault, when trying to run it. In valgrind I get this error message: ==2741== Invalid read of size 4 ==2741== at 0x8049277: load (...
0
votes
0answers
201 views

check() doesn't work properly

check produces wrong output I have tried gdb on the first words and everything seemed right. here is some psuedocode. // while in hashtable // if the word is found return true // if we reach ...
0
votes
1answer
106 views

strcmp node->value

Why strcmp(value,curr->value) returns always 0? I'm using a code like this: char buffer[LENGTH+1] = {}; while(fscanf(inptr, "%s", buffer) > 0) { insert( hashtable, buffer ); } Then, inside ...
0
votes
2answers
231 views

There is no /cs50/ folder in my appliance

There is no /cs50/ folder in my appliance and I do not recall ever seeing it there. According to course text, there should be one in my Home folder. I am on Problem Set 6. Just got Dropbox. (Not ...
1
vote
1answer
127 views

Peeking into large dictionary - Pset6

How do I peek into the large dictionary located at ~cs50/pset6/dictionaries/large? I cannot navigate to that file via the Desktop, and when I am using the terminal, "ls" shows that "large" and "small" ...
0
votes
1answer
232 views

How do I load words in speller that are mixed letters and numbers?

I'm struggling with pset 6 (quite difficult logical and implementation wise, but I like this level of difficulty and this challenge). I'm implementing load and I just found out that I'm 34 words off ...
0
votes
1answer
230 views

Infinite loop in speller.c check function

I can't seem to break out of this infinite loop here is my pseudo code: malloc cursor malloc new_node for(length of word) { if(letter is uppercase) { make letter uppercase } } copy string ...
0
votes
2answers
119 views

Pointers and asterisks

I searched and found Luke's very detailed reply to a similar question, however, my question (and confusion) still remain. I don't understand why we can malloc a pointer to a struct, and this also ...
1
vote
3answers
81 views

Does our implementation of speller need to be able to handle an unsorted input dictionary?

In another post, user1723 touched on a question I had while watching the lecture, sections, and walkthrough on pset6. The question was, why would we need to sort our linked lists, when dictionaries, ...
0
votes
1answer
227 views

Segfault Pset6 Check()

I receive a segfault at this line of code if (pathCheck -> children[charVal] == NULL) { return false; } pseudocode buildup: initialise pathCheck to NULL while character is ...
0
votes
1answer
157 views

Check Value at Children[i] in Trie

In the tutorial video Zamyla states to "check the value at children[i]" Which will return NULL or not NULL. What does check the value mean? Cheers Adam
0
votes
1answer
1k views

Pset 6 - Spell-checker load()

I'm having some problems with spell-checker(pset 6). I'm trying to debugg with gdb, but when I try to run ./spell with gdb the following happens: Reading symbols from /home/jharvard/Dropbox/C/Harvard/...
2
votes
1answer
969 views

Speller works perfectly but check50 shows the error: "\ expected output, but not '\nMISSPELLED WORDS\nThe\nquick\nbrown...'"

I am having some major difficulties with pset6. I have gotten my program to work perfectly as far as I can tell. However when I try to run the program through check50, I get the following error ...
4
votes
1answer
1k views

pset6: Double Free or Corruption error on using free in Unload()

I get the following error on running speller.c: double free or corruption (fasttop): 0x084a7008 And this is what running Valgrind gives: I understand that this error occurs on trying to free ...
2
votes
1answer
651 views

How does the Makefile from pset 6 work?

Could someone help provide clarity in the matter of the Makefile used for pset 6? I understand everything up to line 32, that is where it gets confusing. Here the dependencies for the program $(EXE) ...
0
votes
1answer
335 views

pset 6: Problems using GDB with speller

Whenever I try to run GDB with speller.c and a text file/dictionary, GDB says "file format not recognized". Anyone have any idea what's going on?
0
votes
1answer
108 views

PSET6: Sorted List?

I just finished pset6 following the videos of Zamyla and the section. At the end I realized that my code implements a sorted linked list (via strcmp) but then I don't take advantage of that in my ...
1
vote
2answers
2k views

implementation of hash table

I have been having trouble with the implementation of the hash table and linked lists. I don't know if I am on the right track or not, but I think my main problem is not knowing how to automate the ...
1
vote
1answer
1k views

Pseudocode for Load Function in PSet6

I have hit the wall with the LOAD FUNCTION of PSet6. Does the following pseudocode look correct? Thanks for guidance. open dictionary file. create a node struct create an array of list_pointers (...
0
votes
2answers
48 views

confused by search function in Week 7 "lecture, continued"

I didn't quite follow the lecture; maybe someone can help me. This is regarding Week 7's "Lecture, continued," about 12 minutes in, when Prof. Malan is going over the simple implementation of a search ...
4
votes
1answer
535 views

Improve load time in pset6

So I'm in pset6 and my time is 0.01 seconds slower by the staff's implementation. Should I try to improve it more? Does it matter? If I should improve more how can I do it? Particularly in load as ...
0
votes
1answer
570 views

pset6 check50 doesn't pass for possessives and substrings properly

I probably almost got my pset6 working. When I run the check50 on it, it says: :( handles possessives properly \ expected output, not standard error of "/opt/sandbox50/bin/run.sh: line 31: 184..." ...
1
vote
2answers
287 views

Why should we mod a hash value by the size of the hash table?

Week 7 Short on Hash Table provides the following suggested hash function: int hash_function (char* key) { // hash on first letter of string int hash = toupper(key[0]) - 'A' ; return hash ...
4
votes
2answers
8k views

Why use fgetc instead of fscanf?

In pset6 specification, in question 5, we have been asked why fgetc has been used instead of fscanf. And i don't understand the benefit of using fgetc. So please explain this. Also, in pset 6 ...
0
votes
2answers
414 views

Valgrind error in PSET6

I implemented the tree data structure for pset6. It's all doing it right. On checking with valgrind it is even freeing the memory. The valgrind shows that all the blocks were freed. But the error ...
0
votes
1answer
739 views

Pset6 - Unload() is not freeing the nodes

I wrote the following code for the Unload() function of pset6 : bool unload(void) { node* pred = NULL; for(int i = 0; i < capacity; i++) { nextnode = hasharray[i]; while(...
0
votes
1answer
323 views

Unload() doesn't free any nodes, and throws this error. #pset6

For pset6, in unload(), I'm attempting to free the trie like so: ** * Frees the nodes */ void freeNode(node* ptr) { for (int i = 0; i < 27; i++) { if ((ptr->next[i] != NULL) &...
0
votes
1answer
463 views

How to pass a pointer to the root node to check(), size() and unload() in speller.c?

For speller.c, you can't pass a pointer to the root node (I'm using a trie) to check(), size(), and unload(). And I couldn't create a global root node in dictionary.c error: initializer element is ...

1
13 14 15 16
17