In the following search function for a linked list using the Node and NodePtr as defined in the text) , why is there code to check if here is NULL?
NodePtr searchNodePtr head, int target)
{
NodePtr here = head;
Ifhere == NULL)
{
Return NULL;
}
Else
{
While here->data != target && here->link != NULL)
{
Here = here->link;
}
Ifhere->data == target)
{
Return here;
}
Else
{
Return NULL;
}
}
}
A) the list may be empty
B) the list may be full
C) there is no reason for that code to be there
D) A and B
Correct Answer:
Verified
Q46: As defined in the text, the pointer
Q47: If you need to access the last
Q48: What is wrong with the following definition
Q49: Given the following stack declaration, which of
Q50: What happens if you have two lists
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,
Q56: Given a linked list using the code
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