Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void insertElement(HashTable* htable, const Key key, const Value value)
- {
- int hashedIndex = hash(key, getSize(htable)), i = 1;
- while (htable->table[hashedIndex].key != UNUSED) {
- hashedIndex = hash(key + i, getSize(htable));
- i++;
- }
- htable->table[hashedIndex].key = key;
- htable->table[hashedIndex].value = value;
- // Postcondition: det finns ett element for key i tabellen (anvand lookup() for att verifiera)
- assert(lookup(htable, key)->personalNumber == value.personalNumber);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement