Examveda

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?

A. 1

B. 0

C. linear_search(temp, value)

D. linear_search(temp->next, value)

Answer: Option D


This Question Belongs to Data Structure >> Miscellaneous On Data Structures

Join The Discussion

Related Questions on Miscellaneous on Data Structures