0

am currently implementing speller.c via trie. I have done load function, however, I do not have the foggiest idea of what to do in the check function, especially, as regards accepting only lowercase letters from the text; though I have watched the video several times. please can someone help me with a pseudo-code on how to write the check function for speller.c. Please explain if it is necessary and how to make sure the program accepts only lowercase letters. thank you.

1

From PSET5 guidelines:

  • Your implementation of check must be case-insensitive. In other words, if foo is in dictionary, then check should return true given any capitalization thereof; none of foo, foO, fOo, fOO, fOO, Foo, FoO, FOo, and FOO should be considered misspelled.

check out the tolower() function in ctype.h for the lowercase issue.

for the check - you'll want to take in a word similar to load, and then compare it to what you've loaded it.

Depending on the data structure you've loaded it into, you'll need to vary your approach. Tries will require going character by character, while linked lists will require traversing the list and checking the word. Hash Tables will similarly require hashing the word and checking at the location in the hash table (and possibly checking the linked list).

There are functions to do all of this, strcmp, comparing characters, etc. These you'll have to look up yourself or in other problems on the board.

Good luck.

| improve this answer | |
  • thank you borker. i posted an update to this question. Will you mind responding to it as well? thank you – excel Oct 23 '16 at 1:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .