I have a doubt that when we work with linked list we allocate it memory from dynamic or heap portion and than why we don’t delete it because it may lead into memory leak ??
Regarding memory leak in linked list
Yes,
we should have to delete the nodes to free the memory
it is necessary to avoid memory leakage