From 73a25973d08098fb5d1c849bbfea3b2fbea430a6 Mon Sep 17 00:00:00 2001 From: SATYAJIT PANDA <70535160+satyajitpanda002@users.noreply.github.com> Date: Thu, 1 Oct 2020 00:21:59 +0530 Subject: [PATCH] linear sort algorithm added --- .../Sorting Algorithms/linearsort.c | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Data Structure & Algorithm/Sorting Algorithms/linearsort.c diff --git a/Data Structure & Algorithm/Sorting Algorithms/linearsort.c b/Data Structure & Algorithm/Sorting Algorithms/linearsort.c new file mode 100644 index 0000000..c178c78 --- /dev/null +++ b/Data Structure & Algorithm/Sorting Algorithms/linearsort.c @@ -0,0 +1,21 @@ +#include"stdio.h" + +main() +{ + int x[5]={15,17,3,90,10}; + int i,j,temp; + for(int i=0;i<4;i++) + { + for(j=i+1;j<5;j++) + { + if(x[i]>x[j]) + { + temp=x[i]; + x[i]=x[j]; + x[j]=temp; + } + } + } + for(i=0;i<5;i++) + printf("%d ",x[i]); +}