Skip to content

Instantly share code, notes, and snippets.

Created March 13, 2016 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/a638f4a10bd5f1e50f3d to your computer and use it in GitHub Desktop.
Save anonymous/a638f4a10bd5f1e50f3d to your computer and use it in GitHub Desktop.
load
bool check(const char* word)
{
// create a cursor to iterate through the linked list
node* cursor = hashtable[hash(word)];
// transverse through the list
while (cursor)// -> next != NULL)
{
// if equal non case sensive
if(strcmp(cursor -> word, word) == 0 ||
strcmp(cursor -> word, word) == 32 ||
strcmp(cursor -> word, word) == -32)
{
// word found
return true;
}
// if they don't match, try the next one in the list
else
{
// try next word
cursor = cursor -> next;
}
}
// if it ever equals NULL, the list has ended and the word couldn't be found
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment