main idea is to apply the divide-and-conquer techniquewhereby we divide into subsequencesrecur to sort each subsequenceand then combine the sorted subsequences by simple concatenation in particularthe quick-sort algorithm consists of the following three steps (see figure ) divideif has at least two elements (nothing needs to be done if has zero or one element)select specific element from swhich is called the pivot as is common practicechoose the pivot to be the last element in remove all the elements from and put them into three sequenceslstoring the elements in less than estoring the elements in equal to gstoring the elements in greater than of courseif the elements of are all distinctthen holds just one element--the pivot itself recurrecursively sort sequences and conquerput back the elements into in order by first inserting the elements of lthen those of eand finally those of figure algorithm visual schematic of the quick-sort like merge-sortthe execution of quick-sort can be visualized by means of binary recursion treecalled the quick-sort tree figure summarizes an execution of the quick-sort algorithm by showing the input and output sequences processed at