From 5194b4333f6cd4cd9e1585fe32899e4a2b5f17ef Mon Sep 17 00:00:00 2001 From: Ashish Agrawal Date: Sun, 27 Jul 2014 11:22:53 +0530 Subject: [PATCH] Create insertion_sort.c --- .../Insertion Sort/src/insertion_sort.c | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Chapter 2 - Getting Started/Insertion Sort/src/insertion_sort.c diff --git a/Chapter 2 - Getting Started/Insertion Sort/src/insertion_sort.c b/Chapter 2 - Getting Started/Insertion Sort/src/insertion_sort.c new file mode 100644 index 0000000..a36c010 --- /dev/null +++ b/Chapter 2 - Getting Started/Insertion Sort/src/insertion_sort.c @@ -0,0 +1,26 @@ +#include +void insertion_sort(int[],int); +int main(){ + int a[10],n,i=0; + scanf("%d",&n); + while(i=0&&a[i]>key){ + a[i+1]=a[i]; + i--; + } + a[i+1]=key; + } + for(i=0;i