1. Modified Quicksort I
Reduce the number of swaps using the following approach:
Keep a leftIndex starting at the beginning of the arrayand a rightIndex starting from the end of the array. Thesetrack the current elements being examined that should be stored onthe left of the pivot and on the right of the pivot.
The two variables move in alternating steps: leftIndexincrements and rightIndex decrements.
The left scan stops if it sees a larger element than the pivot;the right scan stops if it sees a smaller element than the pivot;then swap the two.
This continues until left crosses right#include <iostream>using namespace std;void quickSort(int a[], int
PayPal Gateway not configured
PayPal Gateway not configured