NCSU swapListValues & findAndSwapPivot Function & Recall Arrays for Quicksort Program
Question Description
Write a function called swapListValues(). This functions takes an array of integers as its first parameter, and
two indexes (the left and right indexes). This function does not return a value explicitly (it is a void function).
Recall arrays are passed by reference. As the name implies, the two values in the array at the indicated left
and right indexes are to be swapped, and since the array is passed by reference, after returning they will be
swapped for the caller of this function.
2. Write a function called findAndSwapPivot(). This function takes the same 3 parameters, an array of integers,
and two indexes indicating the left and right sides of a sub-portion of the list. The function should find the
value in the middle of the left and right ends, which will be chosen as the pivot. The function should use the
previous swapListValues() function to swap the chosen pivot value to the end of the list of integers. This
function returns a value. This is different from how the textbook implements the find pivot function. Our
function should return the actual pivot value that was chosen (not the pivotIndex, which we know should be
the last index of the sub-list after calling this function).
3. Write a function called partitionList(). This will implement the algorithm described preciously. This
functions takes the 3 same parameters for the previous functions, an integer array, and left and right indexes for
the sub-portion of the list we are currently partitioning. In addition, this function takes a fourth parameter,
the pivot value). This function should make use of the swapListValues() function defined previously when
swapping values in-place in the list of integers. When this function is called, the pivot has been swapped to the
end of the sub-portion of the list, so the right index will be one less than this. This function needs to correctly
return the index, described as k above, where the pivot value should actually go. At the end, the location where
the left search and right search meet will be this index
"Place your order now for a similar assignment and have exceptional work written by our team of experts, guaranteeing you "A" results."