This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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