Consider the following code snippet to find the smallest element in a linked list: [code] struct Node { int val; struct Node*

Consider the following code snippet to find the smallest element in a linked list:
Code:
struct Node
{
     int val;
     struct Node* next;
}*head;
int get_min()
{
      struct Node* temp = head->next;
	  int min_num = temp->val;
	  while(temp != 0)
	  {
	       if(_________)
		    min_num = temp->val;
		temp = temp->next;
	  }
	  return min_num;
}
Which of the following lines should be inserted to complete the above code?
A. temp > min_num
B. val > min_min
C. temp->val < min_num
D. temp->val > min_num
 

Tìm kiếm

Back
Top