im not very good at programing and i would really appreciate the help thank you very much in advance
1. Pick an element, called a pivot, from the list.
2. Reorder the list so that all elements with values less than the pivot come before the pivot, while all
elements with values greater than the pivot come after it (equal values can go either way). After this
partitioning, the pivot is in its final position. This is called the partition operation.
3. Recursively sort the sub-list of lesser elements and the sub-list of greater elements.
The base case of the recursion are lists of size zero or one, which are always sorted.
In simple pseudocode, the algorithm might be expressed as this:
procedure quicksort(array, left, right)
if right > left
select a pivot index //(e.g. pivotIndex := left+(right-left)/2)
pivotNewIndex := partition(array, left, right, pivotIndex)
quicksort(array, left, pivotNewIndex - 1)
quicksort(array, pivotNewIndex + 1, right)
function partition(array, left, right, pivotIndex)
pivotValue := array[pivotIndex]
swap array[pivotIndex] and array[right] // Move pivot to end
storeIndex := left
fori from lefttoright-1//left=i<right
if array[i] = pivotValue
swap array[i] and array[storeIndex]
storeIndex := storeIndex + 1
swap array[storeIndex] and array[right] // Move pivot to its final place
(i) Write a procedure, partition, to implement the partition function.
(iii) Ask the user to enter the number of integers to be sorted, n.
(iv) Ask the user to enter an array of n integers and read it.
(v) Use the quicksort procedure you implemented to sort the array, IntArray. (vi) Display the array, IntArray, after sorting.
A sample execution of the program is shown below:
Enter the number of integers to be sorted: 5 Enter an array of 5 integers: 21356 Array after sorting is: