Home / MCQ Bank / Computer
Computer Miscellaneous On Data Structures

Consider the following code snippet to find the smallest element in a linked list: 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?

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option C • temp->val < min_num

Related Computer Questions

______ function is same as lapply in R. In a regular expression, what does the metacharacter `A` represent? Which of the following is a pointing device? Which of the following communication services of the internet allows the users to talk across the internet to any PC equipped to receive the call? What will be the output of the following C++ code? #include<iostream> #include<iterator> #include<vector> using namespace std; int main() { vector<int> ar = { 1, 2, 3, 4, 5 }; vector<int>::iterator ptr = ar.begin(); ptr = advance(ptr, 2); cout << *ptr << endl; return 0; }