Skip to content

Commit 4c8b484

Browse files
authored
Python
1 parent 4d786c5 commit 4c8b484

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Selection Sort/OddEvenSort.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def OddEvenSort(arr):
2+
for i in range(len(arr)):
3+
for j in range(0 if i % 2 == 0 else 1, len(arr), 2):
4+
if j + 1 < len(arr) and arr[j] > arr[j+1]:
5+
arr[j], arr[j+1] = arr[j+1], arr[j]
6+
return arr

0 commit comments

Comments
 (0)