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;
Whilehere->link != NULL)
{
Here = here ->link;
}
Return here->data;
Delete here;
B) NodePtr here;
Here=head;
Whilehere->link != NULL)
{
Here = here ->link;
}
Delete here;
Return here->data;
C) int tmp;
NodePtr here, there;
Here=head;
Whilehere->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;
Whilehere->link != NULL)
{
There = here;
Here = here ->link;
}
There->link = NULL;
Tmp=here->data;
Return tmp;
Delete here;
Correct Answer:
Verified
Q51: In the following search function for a
Q52: To add an item to a stack,
Q53: Given a linked list using the code
Q54: Given the following function declaration
Void insert NodePtr
Q55: To remove an item from the stack,
Q57: Given the following declarations, which statement would
Q58: The arrow operator ->) specifies
A) a member
Q59: Given the following stack declaration, which of
Q60: If you push the following numbers onto
Q61: When would you use a linked list
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents