Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions sorting/recursiveBubbleSort.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Python Program for implementation of
# Recursive Bubble sort

def bubble_sort(listt):
for i, num in enumerate(listt):
try:
if listt[i+1] < num:
listt[i] = listt[i+1]
listt[i+1] = num
bubble_sort(listt)
except IndexError:
pass
return listt

listt = [64, 34, 25, 12, 22, 11, 90]
bubble_sort(listt)

print("Sorted array:");
for i in range(0, len(listt)):
print(listt[i], end=' ')


# Code contributed by Mohit Gupta_OMG
23 changes: 23 additions & 0 deletions sorting/recursiveBubbleSorting.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Python Program for implementation of
# Recursive Bubble sort

def bubble_sort(listt):
for i, num in enumerate(listt):
try:
if listt[i+1] < num:
listt[i] = listt[i+1]
listt[i+1] = num
bubble_sort(listt)
except IndexError:
pass
return listt

listt = [64, 34, 25, 12, 22, 11, 90]
bubble_sort(listt)

print("Sorted array:");
for i in range(0, len(listt)):
print(listt[i], end=' ')


# Code contributed by Mohit Gupta_OMG