Skip to content

Instantly share code, notes, and snippets.

@CarterZenke
Created October 5, 2022 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 14 You must be signed in to fork a gist
  • Save CarterZenke/94a1b6744316bf3989fbb18afcabab9c to your computer and use it in GitHub Desktop.
Save CarterZenke/94a1b6744316bf3989fbb18afcabab9c to your computer and use it in GitHub Desktop.
#include <cs50.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct node
{
string phrase;
struct node *next;
}
node;
node *table[26];
int hash(string phrase);
bool unload(node *list);
void visualizer(node *list);
int main(void)
{
// Add items
for (int i = 0; i < 3; i++)
{
string phrase = get_string("Enter a new phrase: ");
// Find phrase bucket
int bucket = hash(phrase);
printf("%s hashes to %i\n", phrase, bucket);
}
}
// TODO: return the correct bucket for a given phrase
int hash(string phrase)
{
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment