1. Quick sort
Quick sort is often the most practical choice for an efficient sorting algorithm. Quick sort follows
a divide and conquer strategy. In place sorting and very fast, time complexity is average.
List of integers given in the form of array
To arrange the list of integers in increasing order. First we select one of element from the list, and
this can be any element in this example .We call the selected number Pivot and arrange the list
such that all the element lesser than the pivot are towards the left of it and all the element greater
towards the right. So partition is the process in which we select s pivot and rearrange the list such
that all the elements lesser than the pivot are towards the left and all the elements greater than pivot
toward s the right
2 1 3 4
Here 2, 1, 3 are less which is in left. Once we partitioned the array like this we can break this
segment in two sub segment. Same sorting procedure is carried out in sub segment until the
element
//Initialize array with 5 element,arrange them in ascending order
#include <stdio.h>
void quick_sort(int[ ],int,int);
int partition(int[ ],int,int);
int main()
{
int a[50],size,i;
printf("Enter the elements?");
scanf("%d",&size);
printf("nEnter array elements:");
8 5 7 6