您的位置:首页 > 产品设计 > UI/UE

Quick Sort

2012-10-10 17:05 260 查看
  
Quick Sort firstly introduced by Tony Hoare in 1960 is a divide and conquer algorithm . It is a mostly wide-used algorithm among others.
   The main process of quick sort is as following:

       Quick_Sort(A,i,j) //sort array A from i to j

           if i<j

               p = Partition(A,i,j); //

               Quick_Sort(A,i,p-1)

               Quick_Sort(A,p+1,j)

   As procedure of QS above, the most important and difficult part is the Partition procedure which divide the array into two parts. And, all elements of each part is less or greater than an element,
which is carefully choosen by Partition, indexed by the variant named p. 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  algorithm each