What is the worst time for Hashing with Chaining?

Assume that the number of hash table slots (say, n) is proportional to the number of elements in the table (say, m). We have n = O (m), load factor l = O (m) / m = O (1) So, under the assumption of Simple Uniform Hashing, the search takes an average time on average. This means that an average search requires time proportional to the length of the linked list, which is the same for all slots and, therefore, a constant time. But what about the worst running time on the assumption of Simple Uniform Hashing . Whether it is also constant or will be O (1 + l). Please explain, I'm confused. [CLRS Link Page 260]

In the worst case, for an unsuccessful search, assuming simple uniform hashing will be the same as the average time. And the worst time for a successful search, assuming simple uniform hashing, will be different from the average time.

0
source share
1 answer

Assuming simple uniform hashing (i.e. a hypothetical hashing function will evenly distribute items into hash table slots), I believe that the worst performance for a search operation is the same as in the average case (for a failed search) - Θ(n/m + 1)(average case according to Wikipedia ).

? , , . - , .

, , - / -, ( - ), .

- Θ(n).

Θ(1), . , ( Jim), , , , (.. ).

, , , .

|--------|
|element1| -> element2 -> element3 -> element4 -> element5
|--------|
|  null  |
|--------|
|  null  |
|--------|
|  null  |
|--------|
|  null  |
|--------|
+3

Source: https://habr.com/ru/post/1660838/


All Articles