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...

Which of the following is NOT true about managing system resources?

A) The system resources on your computer include the processor and the memory. B) A buffer is an area that temporarily holds data and instructions. C) A virtual printer does not have a print queue. D) The spooling buffer monitors your system and indicates when emails are ready to be sent.

Computer Science & Information Technology

If a document has multiple sections, by default actions from the Page Setup dialog box apply to:

A) only the current paragraph. B) the entire document. C) only the current section. D) only the current page.

Computer Science & Information Technology

When you create a template, Expression Web automatically creates a(n) ____ for the title so that each page can have a distinctive title.

A. large typeface B. unique font C. bold font D. editable region

Computer Science & Information Technology

One advantage to benchmarking is that best practices change very little over time.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology