Guest User

Untitled

a guest
Jul 3rd, 2014
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. void Insert(int x, hash_t* hashtable) {
  2.  
  3. list* list;
  4. int hashval = hash(x, a, b, hashtable->size);
  5.  
  6. list = malloc(sizeof(list)); // Allocate memory for the list
  7. list->value = x;
  8.  
  9. if (list == NULL) {
  10. hashtable->table[hashval]->next = list;
  11. list = hashtable->table[hashval];
  12. }
  13.  
  14. else {
  15. struct _list* index;
  16. for (index = list; index->next!=NULL; index= index->next) {
  17. }
  18. index->next = list;
  19. }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment