it is a header file
My delete function isn't working
hi @adityakaunhai, you should not be using list stl , as your hashtable is implemented using custom linked list not stl linked list so use the algo same as deletion in linked list and apply that
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);
return;
}
ptr=ptr->next;
}
return;
}
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.