description of quicksort
quicksort is a sorting algorithm who is the most popular algorithm.
quicksort,likes merge sort,is based on divide-and-conquer paradigm;here is the three-step divide-and-conquer process for sorting a typical subarray A[p..r];
Divide:partition the array A into two subarrays A[p..q-1] and A[q+1..r] such that each element of A[p..q-1] is less than or equal to A[q],which is,in turn,less than or equal to each element of A[q+1..r].compute the index q as part of this partitioning procedure.
Conquer:sort the two subarrays by recursive calls to quicksort.
combine:since the subarrays are sorted in place,no work is needed to combine them:the entire array A[p..r] is now sorted.
here,I just want to remind the solution of quicksort;
after this,there will be algorithm and source code for this method.
quicksort,likes merge sort,is based on divide-and-conquer paradigm;here is the three-step divide-and-conquer process for sorting a typical subarray A[p..r];
Divide:partition the array A into two subarrays A[p..q-1] and A[q+1..r] such that each element of A[p..q-1] is less than or equal to A[q],which is,in turn,less than or equal to each element of A[q+1..r].compute the index q as part of this partitioning procedure.
Conquer:sort the two subarrays by recursive calls to quicksort.
combine:since the subarrays are sorted in place,no work is needed to combine them:the entire array A[p..r] is now sorted.
here,I just want to remind the solution of quicksort;
after this,there will be algorithm and source code for this method.
0 Comments:
Post a Comment
<< Home