mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-12-18 01:00:15 +00:00
Bubble Sort
This commit is contained in:
parent
2636f3c62f
commit
e58c46237b
26
BubbleSort.python
Normal file
26
BubbleSort.python
Normal file
|
@ -0,0 +1,26 @@
|
|||
|
||||
|
||||
array=[];
|
||||
|
||||
# input
|
||||
print ("Enter any 6 Numbers for Unsorted Array : ");
|
||||
for i in range(0, 6):
|
||||
n=input();
|
||||
array.append(int(n));
|
||||
|
||||
# Sorting
|
||||
print("")
|
||||
for i in range(0, 6):
|
||||
for j in range(0,5):
|
||||
if (array[j]>array[j+1]):
|
||||
temp=array[j];
|
||||
array[j]=array[j+1];
|
||||
array[j+1]=temp;
|
||||
|
||||
# Output
|
||||
for i in range(0,6):
|
||||
print(array[i]);
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user