Consider the following recursive implementation of linear search on a linked list:
struct Node
{
int val;
struct Node* next;
}*head;
int linear_search(struct Node *temp,int value)
{
if(temp == 0)
return 0;
if(temp->val == value)
return 1;
return _________;
}
Which of the following lines should be inserted to complete the above code?
struct Node
{
int val;
struct Node* next;
}*head;
int linear_search(struct Node *temp,int value)
{
if(temp == 0)
return 0;
if(temp->val == value)
return 1;
return _________;
}A. 1
B. 0
C. linear_search(temp, value)
D. linear_search(temp->next, value)
Answer: Option D

Join The Discussion