Given a linked list (using the code from the book) and assuming there are at least two nodes in the list, which of the following sets of statements would implement a function to return and remove the last item in the list?

a.
NodePtr here;
here=head;
while(here->link != NULL)
{
here = here ->link;
}
return here->data;
delete here;
b.
NodePtr here;
here=head;
while(here->link != NULL)
{
here = here ->link;
}
delete here;
return here->data;
c.
int tmp;
NodePtr here, there;
here=head;
while(here->link != NULL)
{
there = here;
here = here ->link;
}
there->link = NULL;
tmp=here->data;
delete here;
return tmp;
d.
int tmp;
NodePtr here, there;
here=head;
while(here->link != NULL)
{
there = here;
here = here ->link;
}
there->link = NULL;
tmp=here->data;
return tmp;
delete here;

c.
int tmp;
NodePtr here, there;
here=head;
while(here->link != NULL)
{
there = here;
here = here ->link;
}
there->link = NULL;
tmp=here->data;
delete here;
return tmp;

Computer Science & Information Technology

You might also like to view...

A watermark is a text or graphic element that displays ________ the document text

A) above B) below C) to the right of D) behind

Computer Science & Information Technology

The Windows 7 firewall logging feature is enabled by default

Indicate whether the statement is true or false.

Computer Science & Information Technology