title: complexity of minmax_element
body: <p>How is <em>minmax_element</em> typically implemented?
  I can see the time complexity is at most max(floor(3/2(N−1)), 0) applications of the predicate, where N = std::distance(first, last).</p>
  
  <p>Where minmax_element allows me to find the smallest and largest elements in a range of elements that can be iterated over (read: containers).
  For example:</p>
  
  <pre><code>#include &lt;algorithm&gt;
  #include &lt;vector&gt;
  using namespace std;
  
  void Algorithm_minmax_element()
  {
      double x = 2, y = 1, z = 0;
      vector&lt;double&gt; v = { 2, 1, 0, -1 };
  
      auto result1 = minmax(x, y);
      // result1 == pair(1, 2)
      auto result2 = minmax({ x, y, z });
      // result2 == pair(0, 2)
      auto result3 = minmax_element(v.begin(), v.end());
      // result3 == pair(&amp;v[3] = -1, &amp;v[0] = 2)
  }
  </code></pre>