I have been learning about Hash Tables lately. There are a couple of examples of Collision Resolutions and one of them is Quadratic probing.Why would someone use quadratic probing? Does he know that the hash table will always be less than half full? And if so why does he use such a big table to begin with?
Reasons as to use Quadratic Probing for Hash table implementation
5.4k Views Asked by user2278279 At
2
There are 2 best solutions below
0

Quadratic rehash is a very simple and fast way to avoid the clustering problem of linear hash. It's normally used only when table size is prime (which may also be good for other reasons).
To avoid any worry about "table being half-full" it is simplest to switch to linear probe at some point. (You can put the threshold test for such switching inside the usual if (index >= size) {index -= size;} block, to avoid any performance loss.
Assuming we need some collision resolution algorithm,
(From Wikipedia)
Quadratic probing isn't perfect, but it does offer some advantages over alternatives:
(from mjv's answer)
Not necessarily; it depends on the resizing strategy used, if any.
Consider your learning on QP to be primarily educational. Practical hash table implementations don't often use open addressing, in my experience.