首页 > 其他 > 详细

quicksork解析

时间:2018-01-07 21:05:22      阅读:254      评论:0      收藏:0      [点我收藏+]

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解析

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!