From a1232bf8b198e52f58a80ced2406500704192ab0 Mon Sep 17 00:00:00 2001 From: SurabhiMishra <72308754+SurabhiMishra@users.noreply.github.com> Date: Fri, 9 Oct 2020 22:40:11 +0530 Subject: [PATCH 1/2] Create Insertion sort.py --- Insertion sort.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 Insertion sort.py diff --git a/Insertion sort.py b/Insertion sort.py new file mode 100644 index 0000000..093feba --- /dev/null +++ b/Insertion sort.py @@ -0,0 +1 @@ +#to be written From 91068c84b0271055bfd1bf72147a1982bef50a52 Mon Sep 17 00:00:00 2001 From: SurabhiMishra <72308754+SurabhiMishra@users.noreply.github.com> Date: Sat, 10 Oct 2020 01:45:54 +0530 Subject: [PATCH 2/2] Update Insertion sort.py --- Insertion sort.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Insertion sort.py b/Insertion sort.py index 093feba..4b498e0 100644 --- a/Insertion sort.py +++ b/Insertion sort.py @@ -1 +1,15 @@ -#to be written +#List taken from the user and sorted using insertion sort. + +print("Enter the list you want to sort(with spaces)") +l=list(map(int,input().split())) +n=len(l) +print("The list you entered: ",l) + +for i in range(1,n): + value = l[i] + pos=i + while pos>0 and value