[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: 【lua table】Different hashes are chained together，is it bug？
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 17 Apr 2020 10:20:28 -0300
> Now the keys of hash_value = 0 and hash_value = 5 will be linked
> together. Although it does not affect the use, the length of the
> conflict chain becomes longer
> Does this situation meet the original intention of lua table design?
when you have hash slot collisions (8, 16 & 24 all want to go to the
same slot), only one key can go to the "main" slot, the others go to
somewhere else.... which could be the main slot for some other key.
This always is possible in closed hash tables, whatever the method
to handle collitions.