TADM2E 4.3

From Algorithm Wiki
Revision as of 18:13, 11 September 2014 by Algowikiadmin (talk | contribs) (Recovering wiki)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

<pre> Algo - If we create pair of (min1, max2n) (min1, max2n-1)... will provide optimal result 1) Sort the set of 2n element (n log n) 2) Now assign two pointers

  Start: A[0]
  End:   A[2n-1]
  while (start < end)
     pair(start, end)
     start++
     end--
  EndLoop

</pre> --Max 06:55, 25 June 2010 (EDT)