What is the most efficient and standard (C++11/14) way to find the max/min item of vector of vectors?
Any efficient way to calculate the maximum element in a 2-D array(or vector in your case) involves a complexity of
O(n^2) irrespective of what you do, as the calculation involves a comparison between
n*n elements.Best way in terms of ease of use is to use
std::max_element on the vector of vectors.I will not delve into details.Here is the reference.