Q8. Algorithms STL#8
Study the following code snippet:
vector< int > data = {100, 142, 138, 96, 32, 149};
swap(data[2], data[5]);
int val1 = *max_element(data.begin(), data.begin() +3);
int val2 = *max_element(data.begin()+3,data.end());
cout<< min(val1, val2);
Will the above code compile? If yes then what is the output?
swap is not a defined function so an error is thrown.
output is 142, no error is thrown.
max_element is not a defined function so an error is thrown.
output is 138, no error is thrown.
Why is the answer d and not c