We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4d786c5 commit 4c8b484Copy full SHA for 4c8b484
Selection Sort/OddEvenSort.py
@@ -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