TADM2E 4.1

From Algorithm Wiki
Revision as of 14:25, 23 July 2020 by Matt (talk | contribs) (Undo revision 769 by FuckYou (talk))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Sort it with your favorite nlogn sorting algo. The bottom half is one team, the top half the other.

Or much better , partition it with median as pivot . Time complexity O(n).