blob: a06234c48a8e5e3f4aa1ad7424d03fd3ebbab2d6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
class HashTable
MAX_SIZE = 64
def initialize(items = [], max = MAX_SIZE)
@items = items
@max = max
end
def []=(key, value)
@items[key.hash % @max] = value
end
def [](key)
@items[key.hash % @max]
end
end
|