Hash tables have two main features:
- Open addressing , which is a simple array [dynamic array if you can let your table grow on the fly]. As soon as a conflict occurs - you need to use the second hash function to find the next line on which the element will be displayed. Please note that this solution has some problems [which can be solved] when your hash table also allows deleting. [Special mark for "remote" inputs]
- Chain - in this solution, each element in the arrayis a linked list - contains all the items hashed by this input. Here - all elements associated with a certain value are in the list.
- [ ] , (delta) (1) /del/ - .
EDIT: analsis:
p p < 1.
- ""
p , : Sigma(i * p^(i-1) * (1-p)) for each i in [1,n] : Sigma(i * p^(i-1) * (1-p)) = (1-p) * Sigma(i * p^(i-1)) <= (1-p) * 1/(p-1)^2 = 1-p = CONST. [ Sigma (i * p ^ (i-1)) < 1/(p-1) ^ 2 -]. , . : , O(n) . n * O(1) ops [ n ] 1 * O(n) op [rehashing], : (n * O(1) + 1 * O(n)) / n = O(1) , . - (1), . , - , .