Skip to content

Commit dc3422e

Browse files
committed
Add bubble sort algorithm in Python
1 parent 8d44c4e commit dc3422e

File tree

2 files changed

+0
-15
lines changed

2 files changed

+0
-15
lines changed

sorts/bubble_sort.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +0,0 @@
1-
def bubble_sort(arr):
2-
n = len(arr)
3-
for i in range(n - 1):
4-
for j in range(0, n - i - 1):
5-
if arr[j] > arr[j + 1]:
6-
arr[j], arr[j + 1] = arr[j + 1], arr[j]
7-
return arr
8-
9-
10-
if __name__ == "__main__":
11-
data = [64, 34, 25, 12, 22, 11, 90]
12-
print("Original:", data)
13-
print("Sorted:", bubble_sort(data))
14-
15-

sorts/bubble_sort.py.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)