📄 cltnhash.pas
字号:
unit CltnHash;
(*
Hash tables.
The hash tables implement the ISet and IMap interfaces, using a closed
hash table as the implementation. Items with the same hash value are
stored in a dynamic, unordered array.
A possible performance improvement if you know that the trees
are truly ordered is to use a TSortedList instead of TArrayList.
Changing a linear search to a binary search can help speed up
access if the hash table faces many collisions and is densely packed.
I haven't done this because a hash table that does not face
heavy collisions doesn't need the additional overhead. More important
is that as currently implemented, one can use a hash table to
store objects that don't really have a defined order. Yes, they
must implement ICollectible, but sometimes, only a comparison for
equality is meaningful. In that case, a hash table is more suitable
than, say, a tree.
The programmer can set the treshold percentage. When the count/capacity
ratio reaches the threshold, the hash table grows.
The hash table implementation uses a TList for the main hash table.
Each element of the list is either nil or another TList. The sublist
contains the actual ICollectible items.
Copyright
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -