Skip to content

Instantly share code, notes, and snippets.

@globby
Created March 6, 2014 00:11
Show Gist options
  • Save globby/9379482 to your computer and use it in GitHub Desktop.
Save globby/9379482 to your computer and use it in GitHub Desktop.
An implementation of the OddEven sorting algorithm
def oddeven(lst):
sorted_ = False
while not sorted_:
sorted_ = True
for i in range(1,len(lst)-1,2):
if a[i] > a[i+1]:
a[i], a[i+1] = a[i+1], a[i]
sorted_ = False
for i in range(0,len(lst)-1,2):
if a[i] > a[i+1]:
a[i], a[i+1] = a[i+1], a[i]
sorted_ = False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment