destructor of a singular circular linked list, which has no dummy/sentinel nodes.
QUESTION
Write the destructor of a singular
circular linked list, which has no dummy/sentinel nodes.
Solution:
Node
* head = root;
Node * temp = root;
while
(temp->next ==head){
root = temp->next;
delete temp;
temp = root;
}
Delete
temp;
|
Comments
Post a Comment