码迷,mamicode.com
首页 > 其他好文 > 详细

quicksork解析

时间:2018-01-07 22:08:41      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:quick   body   algo   change   hang   4th   str   strong   ref   

quicksork

步骤:

  • shuffle (needed for performance guarantee)
  • partition (scan i and j, repeat until i and j pointers cross. at last, exchange a[lo] with a[j]. )

    – entry a[j] is in place
    – no larger entry to the left of j
    – no smaller entry to the right of j

  • sort recursively

例子:
Q U I C K S O R T E X A M P L E

shuffle:K R A T E L E P U I M Q C X O S
partition: E C A I E K L P U T M Q R X O S
sort left
sort right

参考文献:
Algorithms, 4th Edition

quicksork解析

标签:quick   body   algo   change   hang   4th   str   strong   ref   

原文地址:https://www.cnblogs.com/gangzhuzi/p/8231480.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!