data structures using since [loca[right]interchange the two values and set loc right start scanning from left to right since [loca[left]increment the value of left left right loc right loc left now left locso the procedure terminatesas the pivot element (the first element of the arraythat is is placed in its correct position all the elements smaller than are placed before it and those greater than are placed after it the left sub-array containing and the right sub-array containing and are sorted in the same manner the quick sort algorithm (fig makes use of function partition to divide the array into two sub-arrays partition (arrbegendlocstep [initializeset left begright endloc begflag step repeat steps to while flag step repeat while arr[loc<arr[rightand loc !right set right right [end of loopstep if loc right set flag else if arr[locarr[rightswap arr[locwith arr[rightset loc right [end of ifstep if flag repeat while arr[loc>arr[leftand loc !left set left left [end of loopstep if loc left set flag else if arr[locarr[leftswap arr[locwith arr[leftset loc left [end of if[end of ifstep [end of loopstep end quick_sort (arrbegendstep if (beg endcall partition (arrbegendloccall quicksort(arrbegloc call quicksort(arrloc end[end of ifstep end figure algorithm for quick sort