title: What is the right approach when using STL container for median calculation?
body: <p>Let's say I need to retrieve the median from a sequence of 1000000 random numeric values.</p>
  
  <p>If using anything <strong>but</strong> <code>std::list</code>, I have no (built-in) way to sort sequence for median calculation. </p>
  
  <p>If using <code>std::list</code>, I can't randomly access values to retrieve middle (median) of sorted sequence.</p>
  
  <p>Is it better to implement sorting myself and go with e.g. <code>std::vector</code>, or is it better to use <code>std::list</code> and use <code>std::list::iterator</code> to for-loop-walk to the median value? The latter seems less overheadish, but also feels more ugly..</p>
  
  <p>Or are there more and better alternatives for me?</p>