Erase implementation

erase function implementation is given as homework.
can you please provide me the implementation?

@priyamthakuria27 , you can refer this :-

void erase(string key){
    int idx=hashfn(key);
    node*ptr=table[idx];
    if(ptr->key==key){
        table[idx]=ptr->next;
        ptr->next = NULL;
        delete (ptr);
        curr_size--;
        return;
    }
    while(ptr->next!=NULL){
        if(ptr->next->key==key){
            node*temp=ptr->next;
            ptr->next=temp->next;
            temp->next = NULL;
            delete (temp);
            curr_size--;
            return;
        }
        ptr=ptr->next;
    }
    return;
}