• Source
    1. Input: key k
    2. Output: the value for key k (if found) or null (not found)
    3.  
    4.  
    5.  
    6. start = hashValue(k);
    7.  
    8. i = start; // Start the search at "start"
    9.  
    10. do
    11. {
    12. Entry e;
    13.  
    14. e = bucket[i]; // 3 possibilities:
    15. // (1) null, (2) special AVAILABLE, (3) valid entry
    16.  
    17. if ( e == null )
    18. {
    19. return null; // key k is not in hash table
    20. }
    21. else
    22. {
    23. if ( e == AVAILABLE )
    24. {
    25. i = (i + 1) % capacity; // Continue search
    26. }
    27. else if ( key.equals( e.key ) )
    28. {
    29. return e.value;
    30. }
    31. else
    32. {
    33. i = (i + 1) % capacity; // Continue search
    34. }
    35. }
    36. } while ( i != start ); // Stop when search wrapped around
    37.  
    38. return null; // Not found after search wrapped around....