technique quick sort works as follows set the index of the first element in the array to loc and left variables alsoset the index of the last element of the array to the right variable that isloc left and right - (where in the number of elements in the array start from the element pointed by right and scan the array from right to leftcomparing each element on the way with the element pointed by the variable loc that isa[locshould be less than [right(aif that is the casethen simply continue comparing until right becomes equal to loc once right locit means the pivot has been placed in its correct position (bhoweverif at any pointwe have [loca[right]then interchange the two values and jump to step (cset loc right start from the element pointed by left and scan the array from left to rightcomparing each element on the way with the element pointed by loc that isa[locshould be greater than [left(aif that is the casethen simply continue comparing until left becomes equal to loc once left locit means the pivot has been placed in its correct position (bhoweverif at any pointwe have [loca[left]then interchange the two values and jump to step (cset loc left example sort the elements given in the following array using quick sort algorithm we choose the first element as the pivot set loc left and right loc left left loc left left loc right scan from right to left since [loca[right]decrease the value of right right since [loca[right]interchange the two values and set loc right left right loc since [loca[left]interchange the values and set loc left right start scanning from left to right since [loca[left]increment the value of left right loc scan from right to left since [loca[right]decrement the value of right left right loc