C Program to Implement Quick Sort

This is the C Program to sort an array using quicksort,it uses divide and conquer mechanism to sort the array

Visualization of the quicksort algorithm. The horizontal lines are pivot values.
Class Sorting algorithm
Worst case performance O(n2)
Best case performance O(n log n) (simple partition)
or O(n) (three-way partition and equal keys)
Average case performance O(n log n)
Worst case space complexity O(n) auxiliary (naive)
O(log n) auxiliary (Sedgewick 1978)

[cc lang=”c”]
#include int arr[100],n;

main() { int i,j; printf(“ENTER THE NO”); scanf(“%d”,&n);

for(i=0;imaxsize) return; else { pivot=arr[minsize]; low=minsize+1; high=maxsize; while(low<=high) { while((arr[low]<=pivot)&&(low<=maxsize)) { low++; } while((arr[high]>pivot)&&(high>=minsize)) { high–; } if(low

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *