consider the following list of integers we shall partition this list using the partition function belowdef partition(unsorted_arrayfirst_indexlast_index)pivot unsorted_array[first_indexpivot_index first_index index_of_last_element last_index less_than_pivot_index index_of_last_element greater_than_pivot_index first_index the partition function receives the array that we need to partition as its parametersthe index of its first element and the index of its last element the value of the pivot is stored in the pivot variablewhile its index is stored in pivot_index we are not using unsorted_array[ because when the unsorted array parameter is called with segment of an arrayindex will not necessarily point to the first element in that array the index of the next element to the pivotfirst_index marks the position where we begin to look for the element in the array that is greater than the pivotgreater_than_pivot_index first_index less_than_pivot_index index_of_last_element marks the position of the last element in the list which iswhere we begin the search for the element that is less than the pivotwhile truewhile unsorted_array[greater_than_pivot_indexpivot and greater_than_pivot_index last_indexgreater_than_pivot_index + while unsorted_array[less_than_pivot_indexpivot and less_than_pivot_index >first_indexless_than_pivot_index -