<s>
Hopscotch	B-Algorithm
hashing	I-Algorithm
is	O
a	O
scheme	O
in	O
computer	B-General_Concept
programming	I-General_Concept
for	O
resolving	O
hash	B-Algorithm
collisions	I-Algorithm
of	O
values	O
of	O
hash	B-Error_Name
functions	I-Error_Name
in	O
a	O
table	B-Algorithm
using	O
open	B-Algorithm
addressing	I-Algorithm
.	O
</s>
<s>
It	O
is	O
also	O
well	O
suited	O
for	O
implementing	O
a	O
concurrent	B-Algorithm
hash	I-Algorithm
table	I-Algorithm
.	O
</s>
<s>
Hopscotch	B-Algorithm
hashing	I-Algorithm
was	O
introduced	O
by	O
Maurice	O
Herlihy	O
,	O
Nir	O
Shavit	O
and	O
Moran	O
Tzafrir	O
in	O
2008	O
.	O
</s>
<s>
The	O
name	O
is	O
derived	O
from	O
the	O
sequence	O
of	O
hops	O
that	O
characterize	O
the	O
table	B-Algorithm
's	O
insertion	O
algorithm	O
.	O
</s>
<s>
The	O
desired	O
property	O
of	O
the	O
neighborhood	O
is	O
that	O
the	O
cost	O
of	O
finding	O
an	O
item	O
in	O
the	O
buckets	O
of	O
the	O
neighborhood	O
is	O
close	O
to	O
the	O
cost	O
of	O
finding	O
it	O
in	O
the	O
bucket	O
itself	O
(	O
for	O
example	O
,	O
by	O
having	O
buckets	O
in	O
the	O
neighborhood	O
fall	O
within	O
the	O
same	O
cache	B-General_Concept
line	I-General_Concept
)	O
.	O
</s>
<s>
If	O
some	O
bucket	O
's	O
neighborhood	O
is	O
filled	O
,	O
the	O
table	B-Algorithm
is	O
resized	O
.	O
</s>
<s>
In	O
hopscotch	B-Algorithm
hashing	I-Algorithm
,	O
as	O
in	O
cuckoo	B-Algorithm
hashing	I-Algorithm
,	O
and	O
unlike	O
in	O
linear	B-Algorithm
probing	I-Algorithm
,	O
a	O
given	O
item	O
will	O
always	O
be	O
inserted-into	O
and	O
found-in	O
the	O
neighborhood	O
of	O
its	O
hashed	O
bucket	O
.	O
</s>
<s>
If	O
the	O
hop-information	O
word	O
for	O
bucket	O
i	O
shows	O
there	O
are	O
already	O
H	O
items	O
in	O
this	O
bucket	O
,	O
the	O
table	B-Algorithm
is	O
full	O
;	O
expand	O
the	O
hash	B-Algorithm
table	I-Algorithm
and	O
try	O
again	O
.	O
</s>
<s>
(	O
If	O
no	O
empty	O
slot	O
exists	O
,	O
the	O
table	B-Algorithm
is	O
full	O
.	O
)	O
</s>
<s>
Search	O
the	O
H−1	O
slots	O
preceding	O
j	O
for	O
an	O
item	O
y	O
whose	O
hash	B-Error_Name
value	I-Error_Name
k	O
is	O
within	O
H−1	O
of	O
j	O
,	O
i.e.	O
</s>
<s>
If	O
no	O
such	O
item	O
y	O
exists	O
within	O
the	O
range	O
,	O
the	O
table	B-Algorithm
is	O
full	O
.	O
</s>
<s>
The	O
idea	O
is	O
that	O
hopscotch	B-Algorithm
hashing	I-Algorithm
"	O
moves	O
the	O
empty	O
slot	O
towards	O
the	O
desired	O
bucket	O
"	O
.	O
</s>
<s>
This	O
distinguishes	O
it	O
from	O
linear	B-Algorithm
probing	I-Algorithm
which	O
leaves	O
the	O
empty	O
slot	O
where	O
it	O
was	O
found	O
,	O
possibly	O
far	O
away	O
from	O
the	O
original	O
bucket	O
,	O
or	O
from	O
cuckoo	B-Algorithm
hashing	I-Algorithm
which	O
,	O
in	O
order	O
to	O
create	O
a	O
free	O
bucket	O
,	O
moves	O
an	O
item	O
out	O
of	O
one	O
of	O
the	O
desired	O
buckets	O
in	O
the	O
target	O
arrays	O
,	O
and	O
only	O
then	O
tries	O
to	O
find	O
the	O
displaced	O
item	O
a	O
new	O
place	O
.	O
</s>
<s>
To	O
remove	O
an	O
item	O
from	O
the	O
table	B-Algorithm
,	O
one	O
simply	O
removes	O
it	O
from	O
the	O
table	B-Algorithm
entry	O
.	O
</s>
<s>
One	O
advantage	O
of	O
hopscotch	B-Algorithm
hashing	I-Algorithm
is	O
that	O
it	O
provides	O
good	O
performance	O
at	O
very	O
high	O
table	B-Algorithm
load	O
factors	O
,	O
even	O
ones	O
exceeding	O
0.9	O
.	O
</s>
<s>
Part	O
of	O
this	O
efficiency	O
is	O
due	O
to	O
using	O
a	O
linear	O
probe	O
only	O
to	O
find	O
an	O
empty	O
slot	O
during	O
insertion	O
,	O
not	O
for	O
every	O
lookup	O
as	O
in	O
the	O
original	O
linear	B-Algorithm
probing	I-Algorithm
hash	B-Algorithm
table	I-Algorithm
algorithm	O
.	O
</s>
<s>
Another	O
advantage	O
is	O
that	O
one	O
can	O
use	O
any	O
hash	B-Error_Name
function	I-Error_Name
,	O
in	O
particular	O
simple	O
ones	O
that	O
are	O
close	O
to	O
universal	O
.	O
</s>
