Forum > General

[SOLVED] Hash list with integer as key

<< < (2/5) > >>

Leledumbo:

--- Quote from: Blaazen on December 12, 2014, 08:27:39 pm ---Maybe TFPGMap from unit FGL?

--- End quote ---
It's a list with map-like behavior, not a hash based map.

Take a look at fcl-stl's ghashmap unit (need fpc trunk for best result, latest stable is not fully supported).

mse:
MSEgui has tintegerhashdatalist, lib/common/kernel/msehash.pas.

Blaazen:

--- Quote ---It's a list with map-like behavior, not a hash based map.
--- End quote ---

I guess the only difference is that you have to hash keys yourself (and sort them, otherwise binary search fails).

marcov:

--- Quote from: Blaazen on December 13, 2014, 01:37:13 pm ---
--- Quote ---It's a list with map-like behavior, not a hash based map.
--- End quote ---

I guess the only difference is that you have to hash keys yourself (and sort them, otherwise binary search fails).

--- End quote ---

And that makes insertion performance going down the drain.

Blaazen:
OK, instead of

--- Code: ---Add();
Sort();

--- End code ---
you should do

--- Code: ---Find();
InsertKeyData();

--- End code ---
The hashmap has to do it too (internally).
But yes, if fcl-stl has implemented hash-map, then it's the choice.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version