From e58c46237bdb8949bf063b6ec399ba24cec16eba Mon Sep 17 00:00:00 2001 From: Anup Kumar Panwar Date: Sat, 16 Jul 2016 16:31:51 +0530 Subject: [PATCH] Bubble Sort --- BubbleSort.python | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 BubbleSort.python diff --git a/BubbleSort.python b/BubbleSort.python new file mode 100644 index 000000000..5a0388855 --- /dev/null +++ b/BubbleSort.python @@ -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]); + + + +