




















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





















































Linear probing: when insertion causes collision, check if the next entry is empty, and put the element there. If not go to the right one more… add(element)
Linear probing: when insertion causes collision, check if the next entry is empty, and put the element there. If not go to the right one more… add(element)
Linear probing: when insertion causes collision, check if the next entry is empty, and put the element there. If not go to the right one more… contains(element)
Linear probing: when insertion causes collision, check if the next entry is empty, and put the element there. If not go to the right one more… contains(element) A D L Q S R O Contains( R) Contains( M) Contains( S) Contains( C)
Idea: when insertion causes collision, check if the next entry is empty, and put the element there. If not go to the right one more… When removing mark that location as “deleted” remove(element)
Linear probing: when insertion causes collision, check if the next entry is empty, and put the element there. If not go to the right one more… We have a special object deleted private static final Object deleted = new Object(); add(element)
Linear probing: when insertion causes collision, check if the next entry is empty, and put the element there. If not go to the right one more… contains(element)
Linear probing: when insertion causes collision, check if the next entry is empty, and put the element there. If not go to the right one more… contains(element) A D L de l S R O de l Contains( R) Contains( M) Contains( S) Contains( C)
Linear probing: when insertion causes collision, check if the next entry is empty, and put the element there. If not go to the right one more… delete (element) A D L de l S R O de l delete(S) A D L de l de l R O de l
Linear probing: when insertion causes collision, check if the next entry is empty, and put the element there. If not go to the right one more… What about add(element) Fix: before adding element, check that it is not already in the table A D de l de l S R O de l add(S)
Open Addressing – variants Quadratic probing: add(element)