Created
March 6, 2014 00:11
-
-
Save globby/9379482 to your computer and use it in GitHub Desktop.
An implementation of the OddEven sorting algorithm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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