Please help me out here https://ide.codingblocks.com/s/375459

i didnt get the code of deletion that was given as homework here in the video

Hey @varun1928.joshi
Refer to this https://github.com/coding-blocks-archives/LPNMSUMMERS19/blob/master/Lecture-22/Hashmap.cpp

void erase(string key){
    int idx = hashFunc(key);
    Node<T>* temp = table[idx];
    Node<T>* prev = NULL;

    while(temp != NULL){
        if(temp->key == key){
            if(prev){
                prev->next = temp->next;
            }
            else{
                table[idx] = temp->next;
            }
            temp->next = NULL;
            delete temp;
            return ;
        }
        prev = temp;
        temp = temp->next;
    }
}

If this doesn’t help then let me know what exactly u didn’t get :slight_smile:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.