Re: Benchmarks
Juha Nieminen <nospam@thanks. invalidwrites:
The insert can be quite a complicated procedure. It might be
amortized O(1), but worst-case, it's O(epic fail).
Phil
--
We must respect the other fellow's religion, but only in the sense and to the
extent that we respect his theory that his wife is beautiful and his children
smart. -- Henry Louis Mencken (1880-1956), American editor and critic
Juha Nieminen <nospam@thanks. invalidwrites:
user923005 wrote:
>
Wikipedia says: "Lookup requires inspection of just two locations in
the hash table, which takes constant time in the worst case".
>
I don't understand how that is possible. Suppose an element is
inserted into the table. Then later a new element displaces this first
element to a second location. Then later another new element, to be put
in this second location, displaces this first element to a third
location. How exactly do you find this first element anymore? It's not
in either of the two alternative locations defined by the two hashing
functions for that element.
>Cuckoo hashing has guaranteed O(1) lookup and delete and amortized
>O(1) insert.
>O(1) insert.
Wikipedia says: "Lookup requires inspection of just two locations in
the hash table, which takes constant time in the worst case".
>
I don't understand how that is possible. Suppose an element is
inserted into the table. Then later a new element displaces this first
element to a second location. Then later another new element, to be put
in this second location, displaces this first element to a third
location. How exactly do you find this first element anymore? It's not
in either of the two alternative locations defined by the two hashing
functions for that element.
amortized O(1), but worst-case, it's O(epic fail).
Phil
--
We must respect the other fellow's religion, but only in the sense and to the
extent that we respect his theory that his wife is beautiful and his children
smart. -- Henry Louis Mencken (1880-1956), American editor and critic
Comment