Skip to content

Commit 9d863b2

Browse files
Merge pull request #1310 from akash-ks-coder/master
created wave sort
2 parents 9620e59 + 653b1c7 commit 9d863b2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Sorting Algorithims/wave_sort.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
def sortInWave(arr, n):
2+
arr.sort()
3+
for i in range(0, n - 1, 2):
4+
arr[i], arr[i + 1] = arr[i + 1], arr[i]
5+
6+
arr = []
7+
arr =input("Enter the arr")
8+
sortInWave(arr, len(arr))
9+
for i in range(0, len(arr)):
10+
print(arr[i]', ')

0 commit comments

Comments
 (0)