I did not understand why in this video, the linked list has been deleted recursively. There could be a need to delete only a single key from the linked list. What should be done to remove only a single node from the linked list?
Deleting a node from the linked list in separate chaining
using this statement
~Node(){
if(next!=NULL){
delete next;
}
}
when calling delete next; , you are calling the deconstructor of the next element, and so on. When next is NULL , 0 or nullptr , the process will stop.
hence it deleted the list recursively