Questions tagged [load]

the first part of pset5, loading a dictionary into memory

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

CS50 Speller seems to be stuck even after finding all the incorrect words

I've been completing the fourth problem set on the CS50 course. After checking multiple times for errors in my code I finally managed to make it compile. The program works as it finds all of the ...
0
votes
1answer
61 views

cs50 speller trie: (in c language) can't figure out what i'm doing wrong with load. Seems to work but seems non-existent in other functions

sorry if I am asking the question in a wrong way or my code is too messy I am knew here. My problem is that it looks like load works and the dictionary is loaded into the trie but check and unload ...
0
votes
1answer
50 views

Valgrind 1000000 errors

My code for loading the dictionary in tries is this: // Insert words into trie while (fscanf(file, "%s", word) != EOF) { node *next_node; // Iterate trought every letter of word for (int ...
0
votes
1answer
392 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....
0
votes
1answer
49 views

Speller load() seemingly overwriting each word value

I think my load function is pretty close, but I cannot seem to get it to work properly, I built a function to read the data and I saw it's only storing one word in each bucket. Any ideas on what's ...
1
vote
1answer
113 views

pset4 - speller trie load - ptr not linking up

I have been stuck on the load part of the speller exercise for the tries table. I have gone through a lot of the existing questions and come to the following code: while (fscanf(file, "%s", word) != ...
0
votes
1answer
75 views

Pset5 load - Stuck in infinite nested while loop

I have been working on this problem set for some time. At the moment I am stuck at figuring out why the nested while loop is infinite despite of the fact that there is an fgetc() function that runs ...
0
votes
2answers
141 views

PSet5 Unload(): *** Error in `./speller': double free or corruption (top): 0x0000000002bcb610 *** Aborted

I have been trying to solve this problem for about 3 weeks now...after multiple iterations I just cannot seem to find what I am doing wrong in the load or unload functions to trigger this error. Below ...
0
votes
1answer
246 views

56 Bytes of leaked memory in speller.c pset5

56 Byte memory leak - not sure where it is coming from. Valgrind points to the malloc'd space for nodnew in the load function - in my first version, I created the pointer nodenew and malloc'd the ...
0
votes
1answer
204 views

Load part problem in speller.c CS50 2018 using trie

I am working on "speller.c", and I think I understand the basic concept of trie data structure. But I can barely translate my idea into C language. So here is what I coded with my understanding of ...
0
votes
1answer
45 views

PSET5 speller load (am I on the right track?)

bool load(const char *dictionary) { typedef struct node; { bool is_word; struct node *children[27]; } node; node *root = malloc(sizeof(node)); bool is_word = false; //assigning alphabets ...
0
votes
1answer
154 views

pset 5: How to implement speller load function using mmap?

after implementing speller.c with a trie and a hashtable, I thought I'll give it a shot to use memory mapping. After reading the man page and some further research I had an idea of what to do and ...
1
vote
1answer
121 views

Segmentation Fault Pset5

I wanted to test speller to make sure the dictionary loaded into my trie correctly. However, I received dictionary.c:65:27: runtime error: member access within null pointer of type node' (aka '...
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
336 views

Pset5: What To Do

I would really appreciate help with Pset5 load. I initially wanted to implement a hashtable into my code but after hours of looking I couldn't find a good hashtable from the internet that I wanted to ...
0
votes
1answer
50 views

load function pset5; segmentation fault tackled?

This is the code for my load function bool load(const char *dictionary) { //open dictionary FILE *inptr = fopen(dictionary, "r"); if (inptr == NULL) { fprintf(stderr, "Could not open %s.\n", ...
0
votes
1answer
37 views

checking structure of a hash table? pset5 dictionary

I am currently working on the load dictionary function of pset5. I was wondering if anyone has any suggestions for how to go about checking if the organization of one's hash table and the sorting of ...
2
votes
2answers
2k views

stuck on speller Load function

I am stuck on the load function for speller. I don't quite understand how to insert word into a linked list. This is what I have so far: // Loads dictionary into memory, returning true if ...
0
votes
1answer
100 views

pset5: can't test load() alone?

I tried to compile "speller" to only test my load function (I'm not sure it's correct!). I haven't done the other 3 functions yet (check, size and unload). But clang says there is an error with the ...
0
votes
1answer
298 views

pset5. Speller. How to check load funtion?

typedef struct node { bool is_word; struct children *[27]; } node; node *root = NULL; int words = 0; // Loads dictionary into memory, returning true if successful else false bool load(const ...
0
votes
1answer
315 views

Check function too slow in pset5

I've completed "Speller" successfully, but have been trying to optimise it as the run time for "check" is significantly longer than the staff solution. I suspect the reason is that I don't have ...
0
votes
1answer
298 views

pset5 speller trie load - Dictionary not loading

I am working through pset5 using the trie data structure and it has been very challenging. I finally have code that compiles but when I run it against cat.txt using the small dictionary it returns all ...
0
votes
1answer
56 views

pset5, don't know if [load] successfully, [check] return no misspelled

could you please teach me how to make sure if i load the dictionary successfully. when i run check, no word misspelled.. Thank you. typedef struct node { bool is_word; struct node *children[27]; } ...
0
votes
1answer
68 views

SPELLER-Create Global struct definition and global struct instance

I am working on SPELLER and am stuck on the load function. I have no errors the way it's written but the problem is in this code's location. typedef struct node { ...
0
votes
1answer
108 views

Pset 5 - valgrind errror because of memory leak

Succesfully finished Pset5 except for one memory leak error. This is the Valgrind and Help50 report: ==32337== ==32337== HEAP SUMMARY: ==32337== in use at exit: 47 bytes in 1 blocks ==32337== ...
0
votes
0answers
62 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 ...
0
votes
1answer
46 views

For the spell checker, isn't the dictionary data structure only made of local variables?

For the spell check program, we have to read the dictionary from a file into a data structure (e.g. linked list, hash table with linked lists, a try). However, we have to do this within the function ...
0
votes
1answer
32 views

My program of speller give me so much misspelling words!!

I don't know what I'm doing wrong :s . I'm using the trie to organized the data. This is my implementation of check : // difference between the number Ascii of the letter and it's index in the ...
1
vote
1answer
1k views

Could not load dictionaries/large

Every time I try to run speller.c I get an output of: Could not open dictionary Could not load dictionaries/large I have a feeling that it is to do with the location of the dictionaries but I have ...
0
votes
2answers
805 views

pset5 the load function does't work

the program crashes and is not loading the dictionary. Any hint badly needed. typedef struct node { char word[LENGTH+1]; struct node *next; } node; #define HASHTSIZE 26 node *hashtable[HASHTSIZE] = {...
0
votes
1answer
50 views

[Pset 5 Speller][Load] Segmentation Error

I posted this to the CS50 Subreddit with no help, so i thought i'd post here and try to get some help. My load function is not working, and keeps producing a segmentation error at (hashtable[index]->...
1
vote
1answer
72 views

Program runs fine with small dictionary, seg faults with the large dictionary

I have decided to use trie to implement load in speller and it works fine with the small dictionary (~14 words), however it seg faults with the large dictionary. Using valgrind, it says: Invalid ...
0
votes
1answer
289 views

Problem accessing the last element of the array

I've decided to implement the load function using trie, which I've defined as typdef struct trie { struct trie letters[27]; bool isWord; }trie; then later, when I try to ...
0
votes
1answer
77 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
406 views

Segfault in the if condition

I had the Segmentation fault in the definition of the load function of dictionary.c. typedef struct node { bool is_word; struct node *children[27]; }node; node *root; bool load(const char *...
0
votes
1answer
40 views

nulling myself into a corner with custom new_node() function in speller?

I thought it was a good idea to write a function to create a new node because it seemed to come up more than once. I named it new_node() and it looks like this: struct node *new_node(void) { node ...
1
vote
1answer
849 views

pset5 speller: load() function not working properly

I'm getting pretty close to done with Speller but seem to have hit a snag. I can't really figure out why my load() function isn't working properly..it seems to skip over about 40,000 words in the ...
0
votes
1answer
139 views

i don`t know what is wrong with my unload function?

enter code here /** * Implements a dictionary's functionality. */ #include <stdbool.h> #include<cs50.h> #include <strings.h> #include <stdio.h> #include <...
1
vote
1answer
1k views

PSET5 SPELLER: valgrind error: conditional jump or move depends on uninitialised value(s): but program runs correctly

When I run valgrind on my speller code I get errors that all look similar to this: ==4398== Conditional jump or move depends on uninitialised value(s) ==4398== at 0x401260: load (dictionary....
0
votes
1answer
37 views

c9 CS50 Loads but doesnt show terminal or workspace

Hey i've doing the cs50 course on Cloud9.io but now whenever i load the IDE it loads but doesnt show the terminal or the workspace, I cannot click any of the buttons on the top bar (file, edit, find, ...
0
votes
1answer
125 views

Pset5 Last frown to turn upside down!

I've been slogging away at speller for about 2 weeks now and im tripping over the last hurdle. heres what my check50 was spitting out https://cs50.me/checks/41dd8b60a432fa6adcd672274f3452ba6eedfda3 ...
0
votes
0answers
45 views

Pset5 Speller Tries: How do I copy a character from word into children?

I am using Tries to load dictionary into memory and I am stuck trying to copy characters from the source word into children[] that is part of a new_node structure definition: typedef struct node { ...
0
votes
1answer
97 views

Load function trie segmentation fault

I keep getting segfault for my load function. bool load(const char *dictionary) { //create a trie data type typedef struct node { bool is_word; struct node *children[27]...
0
votes
1answer
362 views

Pset5 Speller Load - Segmentation Fault - Valgrind error: Invalid read of size 8

this is my first post to this forum so I hope I've followed correct procedure. I get a segmentation fault when I run speller. Valgrind says the problem is "Invalid read of size 8" at line 114 in the ...
1
vote
1answer
1k views

PSET5 - spell checker. How can I make my code faster?

My code for pset5 works reasonably well, it passes check50 and isn't orders of magnitude slower than the staff solution, but I'm just wondering where I am losing time. I'm running my code on the large ...
0
votes
1answer
79 views

Pset5: load hashtable - constantly giving seg fault

I'm trying to load my dictionary into memory in order to program my spellchecker. While compiling "speller.c" works fine, my execution ./speller returns a seg fault and I just can't seem to get the ...
0
votes
1answer
55 views

pset5 dictionary issues with wrong number of misspelled words in check using trie

My check function does not get the correct amount of misspelled words. It's always higher than it should be. I figure there must be something wrong with my logic but I can't figure out what. I get the ...
0
votes
1answer
75 views

PSET 5: I've made a mistake somewhere in the load() function but can't pinpoint the problem

So currently I'm working on speller and I suspect that there's a mistake(s) in load(). When I run my code it does load without an error message and correctly checks some words successfully and fails ...
0
votes
1answer
482 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
2k views

pset 5: load, check, unload and size runs but speller.c returns all words as misspelled

Initial Problem I have cleaned up my code but I still can't seem to solve the problem of my speller.c returning all the words in a text file as misspelled. Checking my solution against the staff's ...

1
2
3 4 5
8