From f4c7cbf15466901f3b1fcbabd3553ee2123e3019 Mon Sep 17 00:00:00 2001 From: Yatindra29 Date: Sun, 10 Oct 2021 23:32:59 +0530 Subject: [PATCH] Added quick sort in C --- sorting/quick_sort.c | 48 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 sorting/quick_sort.c diff --git a/sorting/quick_sort.c b/sorting/quick_sort.c new file mode 100644 index 0000000..3d7a3b2 --- /dev/null +++ b/sorting/quick_sort.c @@ -0,0 +1,48 @@ +#include +#include +void swap(int *a,int *b){ + int t=*a; + *a=*b; + *b=t; +} +int partition(int *arr,int low,int high){ + int i=low-1; + int pivot=arr[high]; + for(int j=low;j