Rehash Related Query

At 1:38:13, when the recursive destructor is called on the linked list, shouldn’t the loop be a while loop instead of an if loop.

i.e:

while(next != NULL){

node* temp = next->next;

delete next;

next = temp;
}

Hey @kapurm17
No that is not required. When you call Delete on next node. It also calls delete on next node. This way delete is automatically propagated forward in the linked list. So if the list is lets say 1->2->3.
3 then 2 then 1 will deleted because each time before deleting self delete next is called first.

If your doubt is resolved please mark it as closed.

Oh okay cool yeah got it, destructor will b called for every node! Thanks a lot!