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
1 answer
49 views

Pset5 Speller dictionary entries getting overwritten

I'm having problems with pset5 speller where the words I load into my dictionary hash table are getting overwritten. So for example if I load "Ashley", "Britney" and "Charlie" into my dictionary, all ...
0 votes
1 answer
33 views

Why do I get a sanitiser error when creating this node loop?

This is the loop node *root; root = malloc(sizeof(node)); for(node *ptr = root; counter < length_of_input ; ptr = ptr-> a_node) { if(counter != 0) { ...
0 votes
1 answer
51 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
1 answer
28 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
1 answer
84 views

Check function Segmentation

I am struggling to find the problem in my check function. I have a segmentation fault that it's position varies every time I alter my code a bit. bool check(const char *word) { int index = hash(...
0 votes
0 answers
9 views

pset50 could not unload dictionaries/large

// Implements a dictionary's functionality #include <ctype.h> #include <stdbool.h> #include <stdio.h> #include <string.h> #include <strings.h> #include <stdlib.h> #...
0 votes
0 answers
8 views

how to fix this errorÉ

this is the code i have right now: #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include "CalorieList.h" #include "cstring.h" namespace sdds { void CalorieList::...
0 votes
1 answer
20 views

Speller: memory leak

this is my program // Implements a dictionary's functionality #include <ctype.h> #include <stdbool.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include ...
0 votes
1 answer
35 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
1 answer
18 views

pset5 segmentation faoult

Good morning, I have segmentation fault on my dictionary.c code, I was trying to find a Typ0 mistake or variable declaration mistake but I can not find anyone. Also I can not find logic errors, so I ...
1 vote
1 answer
57 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
1 answer
37 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
1 answer
57 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
2 answers
247 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
1 answer
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
1 answer
244 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
2 answers
291 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
1 answer
49 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
1 answer
44 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
1 answer
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
1 answer
34 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
1 answer
84 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
1 answer
37 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
1 answer
56 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 ...
1 vote
1 answer
425 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
1 answer
66 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
1 answer
10 views

CS50 Speller works but check50 doesn't

My code seems to work fine with all text files. When I look at the errors it doesn't even show actual output, why could that be? https://submit.cs50.io/check50/e963f4484de14f0b73f8fca9a5e9431556cb649a ...
0 votes
1 answer
109 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
1 answer
26 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
1 answer
57 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
1 answer
71 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
1 answer
506 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 ...
0 votes
1 answer
45 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
1 answer
117 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
1 answer
70 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
2 answers
28 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
1 answer
109 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
1 answer
84 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
1 answer
6 views

PSet5 Speller: What is each function in dictionary.c supposed to do?

I've started working on this PSet, and now I'm confused because in the instructions I can't figure out where it tells me what each function is supposed to do. Hash is never even called in speller.c so ...
0 votes
1 answer
261 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
1 answer
64 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 ...
0 votes
1 answer
11 views

PSet5 Speller: Are we hashing the words in the dictionary into a hash table or the words of the text?

I've completed the first function of the Problem set, where I've sorted every word in the dictionary into a trie, but I don't know if I was supposed to do that in the hash function, and something else ...
2 votes
1 answer
53 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
2 answers
57 views

PSET 5 Speller Check50 Problem

I think I have done everything you're supposed to do in PSET5 Speller. when I manually check the outputs of my code, it works perfectly well. It matches the staff solutions one to one. Yet Check50 ...
1 vote
1 answer
69 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
2 answers
79 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 ...
0 votes
1 answer
52 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
1 answer
59 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
1 answer
47 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
1 answer
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 ...

1
2 3 4 5
26