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
1
vote
1answer
46 views

Pset5 Speller — Conditional jump or move depends on uninitialised value(s); Uninitialised value was created by a stack allocation;

My code is able to pass all the tests in check50 except the valgrind one. Here is the error when I run the valgrind. Could someone help me, please? // Implements a dictionary's functionality #...
0
votes
1answer
40 views

How Do I insert information into a trie?

I'm trying to insert true into the second branch of a node. #include <stdbool.h> #include <stdio.h> #include <stdlib.h> typedef struct node { bool correct; struct node *...
0
votes
1answer
26 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
33 views

pset5 memory leak: should freed memory but didn't

I need to operate p in the for loop, therefore I made a copy of the p pointer, and I free p_malloc_orig at last. But the memory is acutally not freed. Where did I possibly do wrong? char *p = malloc(...
0
votes
2answers
60 views

CS50 Speller returns all word as mispelled and I can't find any mistake in my code

I need help, I can't get around this problem set. I have searched everywhere and I think the code is equal to most of the other students... The problem is that the check function is returning true ...
0
votes
1answer
44 views

Last word of dictionary file replaces all the nodes in node bucket

Currently I am working on the load function using a hash table with singly-linked list. I have tested the create(), insert(), and find() function in a separate file and they work as expected. ...
0
votes
1answer
18 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
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....
0
votes
1answer
83 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 ...
0
votes
2answers
280 views

mispellings load won't open file

It took me about a week to figure out that the files for what was formerly pset6 had been moved to the pset5 folder, and that's why my code couldn't open them. Now, however, it is still not opening. I ...
0
votes
1answer
19 views

pset5 speller all words are spelled wrong

new error: most words are seen as spelling error Here's my full code: (UPDATED) // Implements a dictionary's functionality #include <stdbool.h> #include <string.h> #include <stdio.h>...
0
votes
1answer
38 views

pset5 can't share a pointer from load() to check()

I've implemented check() and load() using tries. I have a pointer 'head' to the top of the dictionary trie (NB it's called root in the walkthrough) that I need to pass from load() to check() I ...
0
votes
1answer
39 views

I am having a segmentation fault before my main code runs, but code will compile. pset 5 - speller

// Implements a dictionary's functionality #include "dictionary.h" // Represents a node in a hash table typedef struct node { char word[LENGTH + 1]; struct node *next; } node; // Number of ...
0
votes
1answer
47 views

pset5 check fails possessives and substrings

Ok, so I'm stuck... I finally (hopefully?) got load to work correctly, ie no leaks or errors with valgrind, but now check is giving me a hard time. I only have 135 words misspelled; and it I fails ...
0
votes
1answer
79 views

PSET5. Free a variable outside a loop. leaking memory

I've been stuck for days in the implementation of LOAD with a TRIE data structure. I think my code works (well it doesn't show seg faults) but I am getting a lot of memory leaks. I implemented the ...
0
votes
1answer
61 views

PSET 5 Speller Compiles, But Completely Wrong Output

I spent the last few hours trying to come up with a solution and trawled through questions on this forum but I still can't figure out why my check function is not working out properly. For some reason ...
0
votes
1answer
31 views

Pset5 load problem: Dictionary cannot be loaded

I run my code and it cannot load the dictionary. I'm not sure if the problem is with my code or the file location. Anybody knows why? Thanks in advance.
0
votes
1answer
26 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
268 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 ...
1
vote
1answer
294 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
55 views

Segmentation fault in pset5/speller while linking newNode with the linked list

I have been trying to resolve errors in my speller "load function". I have been able to resolve a couple of them except this one. Debug50 reveals that while creating a link between new Node and the ...
0
votes
1answer
56 views

Speller: valgrind giving me segmentation fault but I can't see what's wrong with my code

I implemented speller and valgrind gives me a segmentation fault, but I just can't find the bug in my code. Please help :( Thanks a lot in advance. #include <stdbool.h> #include <stdlib.h>...
0
votes
1answer
26 views

Collatz Function Iteration

Guys help here I'm so lost as how to answer this question, I'm infact clueless...Find the two smallest different input numbers x,y (with 0<x<y), for which the COLLATZ algorithm takes equally ...
0
votes
1answer
18 views

Pset 5 Speller Load Function Segmentation fault

When I run my load function there is a segmentation fault. It comes at line 80 in my code node* n = malloc(sizeof(node));. I am unsure of how to fix this error. Moreover, I changed my code many times ...
0
votes
1answer
31 views

pset5 speller “Could not load dictionaries/large” error

#include <ctype.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include "dictionary.h" #define ...
0
votes
1answer
59 views

Speller - Program has memory errors, but Valgrind claims all heap blocks were freed

:( program is free of memory errors | pset5 Speller I have invalid reads at lines 148 and 153 of my code (commented out below): bool unload(void) { // CS50 for (int i = 0; i < 26; i++)...
0
votes
1answer
23 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 <...
0
votes
1answer
108 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
2answers
23 views

freeing temporary node in functions

how to free the temporary pointer, one creates during the check function? valgrind shows error on that particular statement tried freeing it only when it has reached null, i.e., transverse over all ...
0
votes
1answer
27 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
61 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
106 views

cs50 pset5 hashtable check, misspelled more than expected

i have been working on the check for many days and not able to find why the misspelled word is more than stuff solution. Rest of the programs looks ok, and i used debug50 ,there is not too much clue. ...
0
votes
1answer
16 views

Unload function pset5

I've completed the pset5 and got all the check50 marks correct, except the valgrind one. What is weird is that Valgrind also say that i've freed everything correctly. Here is the error message that I ...
0
votes
1answer
60 views

Pset5 problem with load function : Keeps getting segmentation fault

I have been working on pset5 and i keep getting segmentation fault while trying to implement 'load' function. I cannot really see where is the problem. Any help will be really appreciated! Here's my ...
2
votes
1answer
30 views

What is the usage of creating DICTIONARY_H in pset5?

I cann't understand when to use the preprocessor directives as (ifndef, define ,etc.)? In dictionary.h, what is the importance of writing those statements? and regarding the reason that was mentioned ...
0
votes
1answer
217 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/...
0
votes
2answers
73 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 ...
1
vote
1answer
64 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
52 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
36 views

(Speller) Search Function returns each word given as false, And when i run Small Dictionary gives me Segmentation Fault

// Implements a dictionary's functionality #include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include <ctype.h> #...
0
votes
1answer
45 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
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
46 views

Pset5 - :( program is free of memory errors valgrind tests failed; rerun with --log for more information.)

// Implements a dictionary's functionality #include <ctype.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #...
0
votes
1answer
331 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
107 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
483 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
148 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
1k views

Speller seems to be working but fails check50. (PSET5)

so currently my speller seems to be working, it matches the staff solution with the austinpowers.txt (correctly identifies that 644 words have been misspelled & works when using a small dictionary ...
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
85 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 ...

1
2 3 4 5
24