1. Quick sort
•Internal sorting technique
•It is also called partitioning sort which
uses divide and conquer technique
2. Working principle
• The quick sort works by partitioning the array
A[1],A[2],…A[n] by picking some value in the
array as a pivot element.
• Pivot element is used to rearrange the
elements in the array
3. • Pivot can be the first element of an array and
the rest of the elements are moved so that the
elements on left side of the pivot are lesser
than the pivot
• Whereas those on the right side are greater
than the pivot
• Now the pivot element is placed in its correct
position
• Now the quick sort procedure is applied for
left array and right array in a recursive
manner.
4. Steps to implement quick sort
• The value of i is incremented till a[i]<= Pivot
• The value of j is decremented till a[j]> Pivot
• This process is repeated until i<j
5. If a[i]> pivot and a[j]<pivot and also if i<j then
swap a[i] and a[j]
If i>j then swap a[j] and a[pivot]
10. void main()
{
int i, count, number[25];
printf("How many elements are u going to
enter?: ");
scanf("%d",&count);
printf("Enter %d elements: ", count);
for(i=0;i<count;i++)
scanf("%d",&number[i]);