Can somebody please explain the concept of buckets simply to me. I understand a Dict
is an array of arrays, I cannot for the life of me make sense of this first block of code though and can't find anything online that explains num_buckets
. If you could explain it line by line that would be great.
module Dict
def Dict.new(num_buckets=256)
# Initializes a Dict with the given number of buckets.
aDict = []
(0...num_buckets).each do |i|
aDict.push([])
end
return aDict
end