Brent’s Method in Data Structure

In this section we will see what is Brent’s Method related to open addressed hashing. This method is a heuristic. This attempts to minimize the average time for a successful search in a hash table.

This method was originally applying on double hashing technique, but this can be used on any open addressing techniques like linear and quadratic probing. The age of an element x, is stored in an open addressing hash table, is the minimum value i, such that x is placed at A[xi]

Brent’s Method tries to minimize the total age of all elements. If we insert an element x, then it will follow some steps − We will find smallest value of i, such that A[xi] is empty, this is where standard open-addressing would insert x. Now consider one element y, which is stored at A[xi-2]. This element is stored there because yj = xi-2, for some value of j ≥ 0. We check if the array location A[yj+1] is empty, then we move y to location A[yj+1], and store x at location A[xi-2].

Compared to normal open addressing, this decreases the total age by 1. In general Brent’s Method checks for each 2 ≤ k ≤ i, the array entry A[xi-k] to see, if the element y is stored, there, can be moved to any of A[yj+1], A[yj+2], . . ., A[yj+k-1], to make room for x.