data structures using temp[indexarr[ ] ++index++else while( <=midtemp[indexarr[ ] ++index++for( =beg; <index; ++arr[ktemp[ ]void merge_sort(int arr[]int begint endint midif(beg<endmid (beg+end)/ merge_sort(arrbegmid)merge_sort(arrmid+ end)merge(arrbegmidend) quick sort quick sort is widely used sorting algorithm developed by hoare that makes ( log ncomparisons in the average case to sort an array of elements howeverin the worst caseit has quadratic running time given as ( basicallythe quick sort algorithm is faster than other ( log nalgorithmsbecause its efficient implementation can minimize the probability of requiring quadratic time quick sort is also known as partition exchange sort like merge sortthis algorithm works by using divide-and-conquer strategy to divide single unsorted array into two smaller sub-arrays the quick sort algorithm works as follows select an element pivot from the array elements rearrange the elements in the array in such way that all elements that are less than the pivot appear before the pivot and all elements greater than the pivot element come after it (equal values can go either wayafter such partitioningthe pivot is placed in its final position this is called the partition operation recursively sort the two sub-arrays thus obtained (one with sub-list of values smaller than that of the pivot element and the other having higher value elements like merge sortthe base case of the recursion occurs when the array has zero or one element because in that case the array is already sorted after each iterationone element (pivotis always in its final position hencewith every iterationthere is one less element to be sorted in the array thusthe main task is to find the pivot elementwhich will partition the array into two halves to understand how we find the pivot elementfollow the steps given below (we take the first element in the array as pivot