




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





13-0: Searching & Selecting
13-1: Sorted List Implementation If database is implemented as a sorted list:
13-2: Sorted List Implementation
If database is implemented as a sorted list:
13-3: BST Implementation
If database is implemented as a Binary Search Tree:
13-4: BST Implementation If database is implemented as a Binary Search Tree:
13-5: Unsorted List Maintain an unsorted , non-contiguous array of elements
Does this sound like a good idea? 13-6: Hash Function
13-7: Hash Function
13-8: Hash Function
13-9: Integer Hash Function
13-17: String Hash Function
13-18: String Hash Function
int hash(String key, int tableSize) { int hashvalue = 0; for (int i=0; i<key.length(); i++) hashvalue += (int) key.charAt(i); return hashvalue % tableSize; }
13-19: String Hash Function
keysize∑− 1
k=
key[k] ∗ 256 keysize−k−^1
13-20: String Hash Function
static long hash(String key, int tablesize) { long h = 0; int i; for (i=0; i<key.length(); i++) h = (h << 4) + (int) key.charAt(i); return h % tablesize; }
13-21: ElfHash
13-22: ElfHash
static long ELFhash(String key, int tablesize) { long h = 0; long g; int i;
for (i=0; i<key.length(); i++) { h = (h << 4) + (int) key.charAt(i); g = h & 0xF0000000L; if (g != 0) h ˆ= g >>> 24 h &= ˜g } return h % M; }
13-23: Collisions
13-24: Open Hashing
13-30: Closed Hashing
13-31: Closed Hashing
13-32: Closed Hashing
13-33: Closed Hashing
13-34: Closed Hashing
13-35: Deletion
13-36: Deletion
13-37: Deletion
13-38: Rehashing
13-39: Rehashing