From 5e3a0d49d0544f5cc98212e1130ab01ee21b135e Mon Sep 17 00:00:00 2001 From: Anup Kumar Panwar Date: Tue, 19 Jul 2016 12:34:43 +0530 Subject: [PATCH] insertion sort --- InsertionSort.python | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 InsertionSort.python diff --git a/InsertionSort.python b/InsertionSort.python new file mode 100644 index 000000000..451f6e905 --- /dev/null +++ b/InsertionSort.python @@ -0,0 +1,27 @@ + + +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(1, 6): + temp=array[i] + j=i-1; + while(j>=0 and temp