Questions tagged [load]

the first part of pset5, loading a dictionary into memory

Filter by
Sorted by
Tagged with
4
votes
1answer
533 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 ...
3
votes
1answer
927 views

Help with PSet 5 2020 - Speller - Check & Unload Functions (EDIT: logic error in Load Function)

EDIT: Fixed the problem. The issue was not with the check or unload function but with the load function which had a small but very significant logic error. Figured it out with some great help from a ...
2
votes
3answers
1k views

PSET5 Speller, faster check and load times hashmap

I am working on the hashmap implementation for the PSET5 Speller problem and seem to keep encountering problems. I have already created a couple of other solutions to the problem (a-z style hashmap ...
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 ...
2
votes
1answer
182 views

CS50 PSET5 Won't Work With Apostrophes

I was testing my program with different texts and I found out that my code lists all words with apostrophes as misspelled, even though I have an if statement in my load function that checks for any ...
2
votes
1answer
784 views

How is staff solution so fast in load and unload?

I have implemented dictionary as a trie and it's working fine. Check50 okays it, so does valgrind. Now, comparing the running times, my check() is as fast as the staff solution, but load() and unload()...
2
votes
2answers
92 views

2019 PSET4 SPELLER, I have no clue why it isn't working, I'm sure size and unload function is right, but unsure about load and check

// Implements a dictionary's functionality #include <ctype.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #...
2
votes
1answer
73 views

How will I know that I uploaded the dictionary sucessfully?

I have just implemented the load function for dictionary, I am just confused right now as to how to check speller if my load was a success, I made the load function on a seperate file and edited the ...
1
vote
2answers
3k views

Try to use trie in pset5

I know if I want to use trie in pset5 to load the dictionary, there should be a struct containing an array of pointers for the alphabets or the apostrophe and a variable of bool. The question is, ...
1
vote
1answer
1k views

How to start with load function in server.c?

I've got problems with implementing load function in server.c. I know general pseudocode, but when it comes to deciding which type variables do I need, I'm a bit stuck. Can someone help me with this?
1
vote
1answer
91 views

Pset6 load returns length zero for php files

First time posting so if I'm off the mark here let me know. Basically, in writing server.c I can't figure out how to test my load function now that I've written it. check50 will only work once I've ...
1
vote
1answer
49 views

pset 5 The dictionary pointer, why is it a char*?

Just wondering, why is the dictionary pointer passed into load a char* instead of a file pointer? Since the dictionaries to be loaded are files.
1
vote
2answers
1k views

Help with .php files in Pset6 -> Load

Me again, still in pset6, right now working on "load", I did this so far: bool load(FILE* file, BYTE** content, size_t* length) { fseek(file, 0, SEEK_END); long size = ftell(file); fseek(...
1
vote
1answer
344 views

pset5:(speller) Check function does not correctly identify misspelled words

/** * Implements a dictionary's functionality. */ #include <stdbool.h> #include "dictionary.h" #include<string.h> #include <stdio.h> #include <stdlib.h> #include<ctype.h&...
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 '...
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 ...
1
vote
1answer
1k views

PSET5 speller (load) - fscanf function error

When I used the fscanf function in the while loop i get the error; "use of undeclared identifier "word". Heres my while loop: while(fscanf(fpt, "%s", word)!= EOF) So first I declared my "word" ...
1
vote
1answer
139 views

Server.c, errors in Check50, probably a problem with load function

I'm almost done with server.c but can't seem to find the last error which doesn't allow me to pass check50. I tried to analyse the existing responses to similar questions but couldn't use them to ...
1
vote
1answer
636 views

Load function correct?

I've been working on the pset6 and implemented the parse and lookup function. I just did something with load function but I am not really much sure if it's correct totally. I haven't implemented the ...
1
vote
1answer
263 views

pset5 - possessives and substrings

I have posted this questions a few days ago, but none of us were getting anywhere. I thought maybe including my code for load as well as check might yield some new revelations. Anyway, here is the ...
1
vote
1answer
220 views

How can I avoid segfaults when sorting my linked list?

I have been working hard with speller but I am stuck when it comes to inserting the nodes in alphabetical order. I am pretty sure I am doing something wrong, but I am not sure exactly where the ...
1
vote
1answer
207 views

Return value of load()

I just finished implementing load() in problem set 6. However there is still one thing I'm still not sure about: When I finish loading the dictionary file, should I return True or return the actual ...
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 (...
1
vote
1answer
25 views

PSET 5 Load Function woes

Back with more questions about my code. 1) fscanf: When using fscanf do we need to iterate through what it is writing to the buffer to check for the null signifier so we can jump in and strcpy that ...
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) != ...
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 ...
1
vote
1answer
850 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 ...
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....
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 ...
1
vote
1answer
37 views

segmentation fault in in load using trie pset5

Can someone tell me why I get segmentation fault? bool load(const char *dictionary) { FILE *fp = fopen(dictionary, "r"); if (fp == NULL) { return false; } char word[45]; while (fscanf(fp, "%s",...
1
vote
1answer
101 views

Pset6: Errors with Check50

When I use check50 to check my parse function, I find that check50 fails multiple tests and that the terminal generates multiple errors. I am using strtok to separate the request line into different ...
1
vote
1answer
163 views

CS50 PSET5 - Segmentation Fault

When I was testing my code, I found that my code gives a segmentation fault using the large dictionary and is unable to load/open the small dictionary. Is this a result of my load function? Thanks in ...
1
vote
1answer
123 views

PSET5: problems with load?

So I'm not getting load to work properly in PSET5. Any tips on what I'm doing wrong? My method now: Scan char by char in file until EOF; increment index (global) Insert each item into the trie ...
1
vote
1answer
118 views

pset5 check function not working

I have tried to implement load/check function as best as I understand it. When I run it, it prints out all the words in the text as misspelled. I don't even know what is wrong with my code at all. ...
1
vote
1answer
109 views

pset5 load with tries, not permanently creating connections between nodes

I'm trying to use tries with pset5. Based on some error checking, it seems the newNodes I'm creating and the links between them are not carrying over from one word to the next. In other words, if the ...
1
vote
1answer
70 views

Pset6 Server works fine for cat.jpg, but fails check50

I've implemented load and indexes and the website seems to work ok. I say ok because it prints out hello, hello, world when I access hello.php, and fails pretty much all the checks in the second ...
1
vote
1answer
66 views

pset6: load gets the first byte from an image file as EOF

My load functions works with all the cs50checks except for the images. It doesn't load the image instead it just shows a white square. When i stepped through it I found out that in my while loop it ...
1
vote
1answer
672 views

pset6 load: fread returns 0

So far, my server seems to be working correctly except when it comes to the step of loading a file into memory. I'm using fread to get the info. from file, and my goal is to store the number of bytes ...
1
vote
1answer
501 views

Images Not Loading in Server.c, but Getting 200 OK Response

I've been grinding on this pset6 problem for days. I've implemented all four functions thus far. After I had only implemented lookup and parse, I passed the server1 check50 so I assume both of those ...
1
vote
1answer
504 views

PSET5 Valgrind memory leak in load() and errors in many contexts

I'm trying to implement a trie for pset5. The program compiles, and appears to spit out the right output, except Valgrind seems to have a LOT of issues with it! First, there's the memory leak, which ...
1
vote
1answer
399 views

CS50 PSET5 Speller Check Gets Skipped, All words misspelled

I am not sure why the words are all coming back misspelled, so I will post the global, check, and load. The run time shows that size and unload never get called. Any help is greatly appreciated. (PS. ...
1
vote
1answer
504 views

how to compile dictionary.c? [duplicate]

I'm having trouble figuring out the problem with my load function. here's the weird error I get (I've never seen something like it): jharvard@appliance (~/Dropbox/pset5): make dictionary clang -ggdb3 ...
1
vote
1answer
378 views

pset5 seg fault when loading a dictionary

When I run my load function with ./speller text, it reported segmentation fault. When I use valgrind to check, it told me that the problem in the two line: char new_word[LENGTH + 1]; while(fgets(...
1
vote
2answers
218 views

unable to load small dictionary

I'm starting on pset6 and planning to use a trie to load the dictionary. I wrote a little code and wanted to test it as follows but it did not print the correct words. The test was done with the small ...
1
vote
1answer
397 views

Help with PSet 5 Load Function

I hope you are well. I am currently on pset 5 where you have to write a spell checker. I am stuck on the load function. I am able to get stuff into my linked list. when I make and run it, I get a ...
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 ...
1
vote
1answer
93 views

Trie isn't working correctly in pset5

I thought my trie was finally working but when I ran it in the debugger using a dictionary containing the words cat and caterpillar, current->children[value] always equalled NULL. I have spent the ...
1
vote
0answers
135 views

Problem in pset5 load

I've been stuck on pset5 load for a while now (like 1 month...) and I've advanced quite a lot but I'm so close to completing it but, unfortunately, I've reached a bit of a dead end when it comes to ...
1
vote
1answer
531 views

Pset5 Speller load() function completely stuck (trie)

I am completely stuck on pset5 load() function, have no idea where to go. Can someone please guide me in the right direction? Here is my code: bool load(const char* dictionary) { // TODO FILE* file = ...
1
vote
1answer
330 views

PSET5 - Issues with initialization of pointers in LOAD function

I'm still trying to debug my load function, I rewrite my code again and again but with no result... I know we need to have specific question, but now I just have so many questions. So, I'll go with ...

1
2 3 4 5
8