This repository contains a clean implementation of Ouick Sort using the Divide And Conquer approach in java
Quick Sort is one of the most efficient sorting algorithms and works by selecting a pivot elements partitioning the array around the pivot and recursively sorting the subarrays .
- Choose a pivot elements ( here the last elements of the array )
- Partion the array so that :
- Elements smaller than the pivot come to the left
- Elements greater than the pivot come to the right
- Recursively apply Quick Sort on :
- Left Subarray
- Right Subarray
- Quick sort (int arr[] ,int si,int ei)
- Recursively sorts the array
- si-> starting index
- ei-> ending index
- Partition (int arr[],int si,int ei)
- Place the pivot elements at its correct position
- Rearrange elements smaller than pivot to the left
- Returns the pivot index
- PrintArray(int arr[])
- Prints the sorted array