doc: update docs for the utility library

- Correct the time complexity of hash table insert.
- Explain more about hash table limitation regarding collisions.
This commit is contained in:
CismonX 2025-03-16 12:48:58 +08:00
parent 18bfbc73da
commit 00ae9dbccb
No known key found for this signature in database
GPG key ID: 3094873E29A482FB

View file

@ -3739,7 +3739,7 @@ Time complexity:
@multitable @columnfractions .33 .33 .33 @multitable @columnfractions .33 .33 .33
@headitem Operation @tab Average @tab Worst case @headitem Operation @tab Average @tab Worst case
@item Insert @tab @t{Θ(1)} @tab @t{O(n log n)} @item Insert @tab @t{Θ(1)} @tab @t{O(n)}
@item Search @tab @t{Θ(1)} @tab @t{O(log n)} @item Search @tab @t{Θ(1)} @tab @t{O(log n)}
@item Delete @tab @t{Θ(1)} @tab @t{O(log n)} @item Delete @tab @t{Θ(1)} @tab @t{O(log n)}
@end multitable @end multitable
@ -3962,6 +3962,10 @@ Limitations:
@item Insertion performance is sacrificed in favor of search performance. @item Insertion performance is sacrificed in favor of search performance.
@item Suffers more from collisions than traditional open addressing. @item Suffers more from collisions than traditional open addressing.
Too many collisions on a single bucket forces a rehash.
With a good-quality hash function, the average load factor of a hash table
should be around 70%~75% before it must rehash.
@item Performance is suboptimal without hardware support for @item Performance is suboptimal without hardware support for
@uref{https://en.wikipedia.org/wiki/Find_first_set, Find First Set}. @uref{https://en.wikipedia.org/wiki/Find_first_set, Find First Set}.