# LCFS Hashing in Data Structure

In this section we will see what is LCFS Hashing. This is one of the open-addressing strategy, that changes the collision resolution strategy. If we check the algorithms for the hashing in open address scheme, we can find that if two elements collide, then whose priority is higher, will be inserted into the table, and subsequent element must move on. So we can tell that the hashing in open addressing scheme is FCFS criteria.

With the LCFS (Last Come First Serve) scheme. The task is performed exactly in opposite way. When we insert one element, that will be placed at position x0. If the place is already occupied by element y, because yj = x0, then we place y at location yj+1, possibly displacing some element z and so on.

According to Poblete and Munro, the expected search time after inserting n elements in an empty table can be bounded by the following formula.

$$E[W]=1+\Gamma^{-1}(\alpha n)\lgroup1+\frac{ln\:ln\:\frac{1}{1+\alpha}}{ln\:\Gamma^{-1}(\alpha n)}+O(\frac{1}{ln^{2}\:\Gamma^{2}(\alpha n)})\rgroup$$

Here Γ is the Gamma function, and

$$\Gamma^{-1}(\alpha n)=\frac{ln\:n}{ln\:ln\:n}\lgroup1+\frac{ln\:ln\:ln\:n}{ln\:ln\:n}+O(\frac{1}{ln\:ln\:n})\rgroup$$