Consider the following recursive implementation to find the largest element in a linked list: [code] struct Node { int val; struct

Thê Hy

New member
Consider the following recursive implementation to find the largest element in a linked list:
Code:
struct Node
{
     int val;
     struct Node* next;
}*head;
int max_of_two(int a, int b)
{
      if(a > b)
        return a;
      return b;
}
int recursive_get_max(struct Node* temp)
{
      if(temp->next == 0)
        return  temp->val;
      return max_of_two(______, _______);
}
Which of the following arguments should be passed to the function max_of two() to complete the above code?
A. temp->val,recursive_get_max(temp->next)
B. temp, temp->next
C. temp->val, temp->next->val
D. temp->next->val, temp
 

Tìm kiếm

Back
Top