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 fa51f76 commit cd5ce5dCopy full SHA for cd5ce5d
Algorithms/Sorting Algorithms/bubble_sort.py
@@ -0,0 +1,20 @@
1
+__author__ = 'Avinash'
2
+
3
4
+def bubble_sort(sort_list):
5
+ for j in range(len(sort_list)):
6
+ for k in range(len(sort_list) - 1):
7
+ if sort_list[k] > sort_list[k + 1]:
8
+ sort_list[k], sort_list[k + 1] = sort_list[k + 1], sort_list[k]
9
+ print('\nThe sorted list: \t', sort_list)
10
+ print('\n')
11
12
13
+lst = []
14
+size = int(input("\nEnter size of the list: \t"))
15
16
+for i in range(size):
17
+ elements = int(input("Enter the element: \t"))
18
+ lst.append(elements)
19
20
+bubble_sort(lst)
0 commit comments