in reply to Re^5: What makes an array sorted and a hash unsorted?
in thread What makes an array sorted and a hash unsorted?
You cannot speak generally of the intrinsic sequence of the elements of a hash. It is not a fixed quantityIt most certainly is. Each hash element is mapped to a bucket using a fixed function: hash(key,seed,nr_of_bufs). key is the key to be hashed, seed is fixed at program start, and nr_of_bufs is the current number of buffers used. But there's no randomness involved in the hash function. Given the same input parameters, the result will always be the same. It's a deterministic function. Arrays can be seen as a special case, where the "hash" function is just sub hash {0+$_[0]}.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^7: What makes an array sorted and a hash unsorted?
by herveus (Prior) on Jun 03, 2009 at 18:33 UTC | |
by JavaFan (Canon) on Jun 03, 2009 at 20:31 UTC |