Advertisement
Guest User

Untitled

a guest
May 29th, 2015
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. void _setTableSize(struct hashMap * ht, int newTableSize)
  2. {
  3. /*write this*/
  4. /* Group 30: Worksheet 38, resizeTable */
  5.  
  6. /* get the old size */
  7. int oldSize = ht->tableSize;
  8. struct hashLink **old = ht->table;
  9.  
  10.  
  11. /* make the pointers */
  12. hashLink *cur;
  13. hashLink *last;
  14.  
  15. /* make the hashMap */
  16. _initMap(ht, newTableSize);
  17.  
  18. for(int i = 0; i < oldSize; i++){
  19. cur = ht->old[i];
  20. while(cur != 0){
  21. insertMap(ht, cur->key, cur->value);
  22. last = cur;
  23. cur = cur->next;
  24. free(last);
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement