Which of the following would completely remove all the nodes in a linked list and return them to the freestore?
void free(NodePtr head)
{
//what goes here?
}
a.
if(head == NULL)
return;
else
{
free(head->link);
delete head;
}
b.
NodePtr here, prev;
while(head->link != NULL)
{
here=head;
prev= head;
while(here->link != NULL)
{
prev=here;
here=here->link;
}
delete here;
prev->link=NULL;
}
delete head;
c.
NodePtr here, prev;
while(head != NULL)
{
here=head;
while(here->link != NULL)
{
prev=here;
here=here->link;
}
delete here;
prev->link=NULL;
}
delete head;
d.
NodePtr here, prev;
while(head->link != NULL)
{
here=head;
prev= head;
while(here->link != NULL)
{
prev=here;
here=here->link;
}
delete here;
prev->link=NULL;
}
delete head;
e. all of the above
f. A and B
g. B and C
f. A and B
You might also like to view...
Which if the following is a factor for determining the legality of a search warrant?
a. Probable Cause b. Relevance c. Particularity d. Scope
Comments are attached to a document in general, not to a specific location within a document
Indicate whether the statement is true or false
A Web resource that categorizes articles and information is called a(n) ____.
A. mind map B. subject guide C. scheduler D. works cited list
The action carried out by malware code is referred to as a(n) _______.
Fill in the blank(s) with the appropriate word(s).