I understand that if the load factor were 2, then the length of the chain would be 2 for each index in the array, but what happens if the load factor is a decimal? Do we round up or down?

  • 1
    $\begingroup$ Are you referring to some specific implementation? In general if the load factor is $2$ (resp. any other positive rational number $\alpha$) you cannot say that the length of each chain is $2$ (resp. $\lfloor \alpha \rfloor$ nor $\lceil \alpha \rceil$). The number $2$ is just the average length of a chain. It could be attained (e.g.) with $n$ buckets and $2n$ elements, where all elements are mapped to the same bucket. $\endgroup$ – Steven Mar 21 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.