Skip to content

Instantly share code, notes, and snippets.

@DRMacIver
DRMacIver / maj.py
Last active December 13, 2015 22:39 — forked from Zarkonnen/maj.py
# Naive majority judgement implementation. Bigger numbers are better.
def majority_ranking(a):
a = sorted(a)
while a:
x = a[len(a) / 2]
del a[len(a) / 2]
yield x