template <typename Key, typename Element, typename HashCmp> LinearProbeHashTable<Key, Element, HashCmp>::EntryPtr LinearProbeHashTable<Key, Element, HashCmp>:: finder(const Key& key) const { // search utility int i = hash.hashValue(key) % N; // get hash index int start = i; // starting point do { if (A[i].status == EMPTY) return NULL; // item is not found if (A[i].status == USED && hash.isEqualTo(A[i].key(), key)) // found it return &A[i]; // return with success i = (i + 1) % N; // try next slot } while (i != start); // until back to start return NULL; // return with failure } template <typename Key, typename Element, typename HashCmp> LinearProbeHashTable<Key, Element, HashCmp>::EntryPtr LinearProbeHashTable<Key, Element, HashCmp>:: inserter(const Key& key, const Element& element) { // insert utility int i = hash.hashValue(key) % N; // get hash index int start = i; // starting point do { if (A[i].status != USED) { // slot is available? A[i] = HashEntry(key, element, USED); // store it here n++; // increase size return &A[i]; // return with success } i = (i + 1) % N; // try next slot } while (i != start); // until back to start return NULL; // return with failure }