Vidyalelo
Data Structure · Q272

Miscellaneous on Data Structures

Programming · Data Structure · question 272

Q272

Consider the following recursive implementation to find the largest element in a linked list: 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)
Answer
B.
temp, temp->next
C.
temp->val, temp->next->val
D.
temp->next->val, temp

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board