?? 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 + -