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 search(NodePtr head, int target)
{
nodePtr here = head;
if(here == NULL)
{
return NULL;
}
else
{
while( here->data != target && here->link != NULL)
{
here = here->link;
}
if(here->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
a. the list may be empty
You might also like to view...
The decision as to which process' pending I/O request shall be handled by an available I/O device:
A) ?long-term scheduling ? B) ?short-term scheduling C) ?I/O scheduling ? D) ?medium-term scheduling
__________ considers the execution history of a related group of processes along with the individual execution history of each process in making scheduling decisions.
A) ?TAT ? B) ?HRRN ? C) ?FSS ? D) ?FCFS