Questions tagged [dictionary]

The tag has no usage guidance.

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

pset6 DNA - help creating and referencing dictionaries

This may be a strange question - my code actually worked, but I feel like I got to a solution by brute force, rather than something more elegant. I'm still not sure how to create and reference ...
user avatar
  • 1
0 votes
1 answer
38 views

PSet5 - Dictionary loading only one word

I've been banging my head for the last few hours as to why my dictionary function only saves one word from the whole dictionary. Even though debug50 and printf shows different hashes for different ...
user avatar
0 votes
0 answers
25 views

Finding a list of integers in a list of dictionaries containing strings

I am working on Pset6. I have distilled the matching Short Tandem Repeats found in the DNAsequence down to a list of integers stored in a list variable. What I want to do is locate the presence of ...
user avatar
0 votes
1 answer
72 views

Program is free of memory errors, valgrind tests failed - pset5 speller

I'm am getting this error - program is free of memory errors, valgrind tests failed; see log for more information. I have tried so many things but I keep getting more errors. Here is my code: // ...
user avatar
0 votes
1 answer
78 views

PSET6 DNA Why is my (count consecutive substrings in string) function always returns 0's?

I tried writing different function variations but my count_dna function keeps returning zeroes (despite having consecutive sequences of STRs in the dna sequences)--can anyone please tell me why? Note: ...
user avatar
2 votes
1 answer
46 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 ...
user avatar
0 votes
2 answers
122 views

Pset5 Speller,Check function isn't working as expected, strcasecmp always returns false

The problem is the word is found in loaded dictionary it's found but check function still returns false i've been like 7 days in this problem someone helps please, ((I'm Trying to test code ./speller ...
user avatar
  • 5
0 votes
1 answer
52 views

Print keys of CSV files in DNA pset6

I want to see what the keys of the reader dictionary are so I use the print(key) function. The result is all the lines of the dictionary. Why is that? import csv from sys import argv, exit # Check if ...
user avatar
  • 3
0 votes
1 answer
40 views

Pset 5 Speller: Could not load small

I don´t know what may be happening with my code. When I run it without any dictionaries it runs (although is also not able to open cat.txt), but when I try to run it using small it could not load it. /...
user avatar
0 votes
1 answer
46 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 ...
user avatar
0 votes
1 answer
83 views

I dont understand valgrind pset5

Error from valgrind $ valgrind ./speller texts/cat.txt ==1453== Memcheck, a memory error detector ==1453== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==1453== Using Valgrind-3.13....
user avatar
0 votes
1 answer
282 views

Finance index function does not return lookup value in index.html

I'm trying to render my lookup values inside of my index function implementation, but I cannot get these values to render in my index.html page. I added share = lookup(record['share_symbol']) to grab ...
user avatar
0 votes
1 answer
71 views

Finance index.html is not rendering values from my index function

I'm having some issues trying to render values on my index.html page. In my index function, I created a dictionary of values from my transactions table to grab each record of my share symbols, share ...
user avatar
0 votes
1 answer
74 views

Please help! I'm stuck on Pset5 Speller!

#include <stdbool.h> #include <stdlib.h> #include "dictionary.h" #include <string.h> #include <stdio.h> #include <ctype.h> int wordCount = 0; // Represents a ...
user avatar
1 vote
2 answers
60 views

Pset5: check unable to find words

Thankfully, I don't get any seg faults so I'm guessing unload() is working properly. Also, load() seems to run correctly when debugging, so I'm guessing the problem isn't on loading either. I don't ...
user avatar
0 votes
1 answer
54 views

PSET5 Speller everything works but then I catch all the words as misspelled

Basically when I run the test with texts/lalaland.txt and compare to the staff's key, they have something like 955 misspelled words and I have all but 5 misspelled. I tried to but a "tolower"...
user avatar
  • 15
0 votes
1 answer
249 views

pset5 valgrind tests failed

I'm very close to completing pset5; all smiley faces except the Valgrind memory leak. I'm hoping someone can help find the problem. I am only leaking 112 bytes and have tried to fix the issue by ...
user avatar
  • 11
0 votes
1 answer
66 views

PSET 5 My hash table doesn't seem to be storing correctly

When I load the dictionary, I add the words to the hash table, by calling the hash function to calculate the bucket ID, then add hash function to actually insert it into the list. Inside the addhash ...
user avatar
0 votes
2 answers
146 views

strcpy not working with struct items

bool load(const char *dictionary) { char splitStrings[9999][45]; FILE* dict = fopen(dictionary, "r"); node* item = table[0]; int i = 0; for (i = 0; fscanf(dict, "%...
user avatar
0 votes
0 answers
123 views

check50 keeps printing "Could not load basic/dict." what might be the problem in the code?

// Implements a dictionary's functionality include include include include "dictionary.h" include include include // Number of buckets in hash table define N 120000 //maximum length of ...
user avatar
1 vote
0 answers
109 views

PSET6: dna.py, updating dictionary

I'm struggling with Python, specifically adding/updating keys and values in a dictionary. This is my code so far (I know it's probably far from perfect, this is my first time working with Python, ...
user avatar
  • 13
0 votes
1 answer
144 views

pset5 speller "Could not load dictionaries/large"

I cannot figure out what I am missing. Program keeps returning "Could not load dictionaries/large" I have checked and tried different suggestions from similar questions but I do have the folder ...
user avatar
  • 5
0 votes
1 answer
80 views

CHECK50 ERRORS IN SPELLER PSET

Here is my code for the pset I am getting 2 errors after check50. I am not able to get hold of any loopholes in the code. Kindly help! 1) :( handles max length (45-char) words expected "MISSPELLED ...
user avatar
0 votes
1 answer
41 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 ...
user avatar
0 votes
1 answer
25 views

trie speller works on custom dict but misses mispellings on large dictionary

So my speller works fine with a custom dict, but not with the large dict. This is my code in dictionary.c (haven't modified other files): // Implements a dictionary's functionality #include <...
user avatar
  • 3
0 votes
1 answer
20 views

Pset4 Speller (Hash table) word count only fails in check50

All of the "WORDS IN DICTIONARY: " parts are resulting in "0" but when i run the code on my computer trying both the "small" and "large" dictionary it seems to work perfectly. So what might be the ...
user avatar
  • 1
1 vote
0 answers
33 views

dictionary hints?

I just submitted my dictionary code to the Big Board. My results weren't horrific (well, I did use more memory than anyone else, lol); but I'm a little disheartened when comparing to the best results. ...
user avatar
  • 185
0 votes
1 answer
30 views

dictionary.c trie: setting variable to NULL doesn't set element to NULL

Working on the unload function in speller (dictionary.c)... My current test dictionary simply contains a letter c, as I'm just trying to make sure one iteration will work. So I should (and do, ...
user avatar
  • 185
0 votes
1 answer
108 views

Check50 issues, Pset 4, Speller

My code finally works, and I believe it is operating correctly but check50 says otherwise. Anyone see any blatant issues in my code that you can point out? // Implements a dictionary's functionality ...
user avatar
1 vote
0 answers
62 views

CS50, pset2, crack, suggested dictionary file

I am taking cs50 on edx and I am currently on pset2, crack. I want to find a dictionary file that has a fair (maybe over 50,000?) amount of words in it to encrypt and compare them with the hashed ...
user avatar
0 votes
1 answer
268 views

Unload works on small dictionary, but not on large? (speller.c / hash table method)

When testing with the small dictionary, it unloads as expected however when testing with the large dictionary, I receive the error "Could not unload dictionaries/large." The only difference that I've ...
user avatar
0 votes
0 answers
31 views

I keep getting seg faults when running code

I've been looking through my code, but I'm unable to figure out why my code keeps seg faulting. I used my own custom hash function to take the first character of each string in the dictionary to 26 ...
user avatar
0 votes
1 answer
222 views

2018 pset4 dictionary check() doesn't check dictionary

I'm in a pickle here. I have followed walkthrough step by step for this part. But my code just keeps on refusing to load dictionary. (Sorry for the low quality code here) bool load(const char *...
user avatar
0 votes
1 answer
78 views

Scramble.c lookup function found flag

So I've got the binary search function working for this problem, but I have no idea how to deal with the "found" flag portion of the problem. I think the idea is to add a "true" condition to the bool ...
user avatar
0 votes
1 answer
44 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 ...
user avatar
0 votes
1 answer
958 views

error: use of undeclared identifier 'word'

I've been having quite a few issues with Pset5 and I can't figure anything out. I've been playing around with the placement of 'char word[LENGTH+1]' but I always get an error: "use of undeclared ...
user avatar
  • 157
0 votes
1 answer
188 views

dictionary.c not iterating through the linked list, if the hash exists it always returns true

Trying to figure out a bug in my dictionary.c code. Please bear with me as I try to explain the bug. I've been using the debugger, and it seems that anytime there is a collision in my hash table, ...
user avatar
0 votes
1 answer
305 views

Please help with Speller: all words return misspelled

I've combed through my code for this pset and reviewed the walkthroughs and shorts countless times and am now resigned to admit I need help. Thanks to Peter, I'm no longer leaking any memory (yay!), ...
user avatar
  • 17
0 votes
1 answer
482 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: "...
user avatar
0 votes
1 answer
114 views

Problem in unload

I am having problem in my unload. While running valgrind it shows no leaks, but the program wont acquiesce check50. Here is the unload function: //free the memory bool freenode(node *first) { //...
user avatar
0 votes
2 answers
236 views

Pset5 - Valgrind causes 9544106 errors, Uninitialised value was created by a heap allocation

Im unsure if there is any error in my recursion in unloading/unload to free all memory. (But i doubt so because help50 tells me all my memory were freed- 367,084 allocs, 367,084 frees) I checked ...
user avatar
0 votes
1 answer
108 views

pset5 speller dictionary errors

Can someone give me feedback on my code please? I can't compile this, and it says too many errors. A lot of the errors don't seem to make sense. For example, it says "error: use of undeclared ...
user avatar
0 votes
2 answers
78 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 ...
user avatar
0 votes
1 answer
644 views

Need help with check in speller (trie)

Stuck on speller, especially check, but load has some problems too. I am using a trie, but I kind of regret choosing it, because it has been very tough. I believe my problem is with the use of *next ...
user avatar
0 votes
1 answer
1k views

pset5 speller Invalid write of size 1

my implementation of dictionary.c passes all checks using check50 except memory leaks. I'm using valgrind and most of my leaks seem to be happening in my check function: // Returns true if word is ...
user avatar
  • 157
0 votes
1 answer
53 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 ...
user avatar
0 votes
1 answer
439 views

Segmentation Fault on Hashtable

PLease Someone help me I was trying to implement a hash table that stores the word of English language for pset 5. So to be in brief, I used an array of linked list ( Chaining ) , I haven't made the ...
user avatar
0 votes
1 answer
256 views

scramble lookup function

I'm having a lot of difficulties with this problem since there are lots of concepts that I don't know. I'm trying to treat dictionary as an array of strings as below: bool lookup(string s) { int min =...
user avatar
0 votes
1 answer
53 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. ...
user avatar
  • 1
0 votes
1 answer
85 views

PSET5: load fails with large dictionary, but works with small dictionary - trie

I'm trying to use a trie structure to implement the load function in speller. I get a segmentation fault with the large dictionary, but not the small one. Text file size does not seem to matter, (I ...
user avatar