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 each node of the quick-sort tree the step-by-step evolution of the quick-sort tree is shown in figures and unlike merge-sorthoweverthe height of the quick-sort tree associated with an execution of quick-sort is linear in the worst case this happensfor exampleif the sequence consists of distinct elements and is already sorted indeedin this casethe standard choice of the last element as pivot yields subsequence of size while subsequence has size and subsequence has size at each invocation of quick-sort on subsequence lthe size decreases by hencethe height of the quick-sort tree is ( (bfigure quick-sort tree for an execution of the quick-sort algorithm on sequence with elements(ainput sequences processed at each node of (boutput sequences generated at each node of the pivot used at each level of the recursion is shown in bold