I was reading an answer to a question asked here: Why does hashcode() returns an integer and not long?
My question is: Why hashcode based data structures use an array to create bins?
I was reading an answer to a question asked here: Why does hashcode() returns an integer and not long?
My question is: Why hashcode based data structures use an array to create bins?
Because array is a low-level data structure which allows random access to its elements.
You need a "low-level" data structure to base a "higher-level" data structure on.
You need random access so that you can address bins very fast.
cause, an array is based on integer-based indexes! now you can show some curiosity, why array using integer-based indexing. one of the assumptions should be -- if you could able to use other types (real numbers) rather than using integer, just think how many dimension you would capable to add -- for example --
for 1-th index, you could capable to add sub-indexes like -- 1.1, 1.2, 1.1.2, 1.1.1.1.2 and so on so forth!
doing so, it will create more overhead, rather than popping up the solution we want.