- 1、本文档共6页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Everything You Always Wanted to Know about Quicksort, but Were Afraid to Ask
Algorithms Seminar 2001–2002,
F. Chyzak (ed.), INRIA, (2003), pp. 57–62.
Available online at the URL
http://algo.inria.fr/seminars/.
Everything You Always Wanted to Know about Quicksort,
but Were Afraid to Ask
Marianne Durand
Projet Algorithmes, Inria Rocquencourt (France)
November 5, 2001
Summary by Michel Nguy??en-Th′?e
Abstract
The algorithm Quicksort was invented by Hoare in 1960. Numerous improvements have
been suggested since then, like optimization of the choice of the pivot or simultaneous use
of several pivots or also hybrid methods. Different parameters like the cost of comparisons,
the size or the height of the associated binary search tree have been studied for Quicksort
and its variants. We present here the principal methods used to get the mean, the variance,
and the nature or at least a few properties of the limit laws of these parameters.
1. Description of the Algorithm and of a Few Variants
1.1. Quicksort. The procedure Quicksort takes as arguments an array A of n elements and two
integers First and Last representing indices of elements of the array. The algorithm runs as follows:
if First Last then:
1. Choose a pivot in the array (e.g., A[First]).
2. Partition the elements in the subarray A[First] . . . A[Last] so that the pivot value is in place
(let PivotIndex be its position then).
3. Apply Quicksort to the first subarray A[First] . . . A[PivotIndex? 1].
4. Apply Quicksort to the second subarray A[PivotIndex + 1] . . . A[Last].
1.2. Variants. In step 1, the pivot is chosen in a fixed manner. It is possible to use a strategy to
choose the pivot to improve the efficiency of the algorithm. By choosing the pivot randomly, we can
wipe out the possible bias of the data we want to sort. The pivot is all the more efficient if it cuts
the array in two arrays of similar size. With this aim in view, the Quicksort with median of 2t+ 1
consists in picking out 2t + 1 elements randomly in the array to sort, where t is a fixed integer,
and to choose as pivot t
您可能关注的文档
- Description of the RACER System and its Applications.pdf
- Description Usage.pdf
- DescriptionofElectrostaticModules.pdf
- Design and results of the 1st satisfiability modulo theories competition (SMT-COMP.pdf
- Design and Results of the 2nd Annual Satisfiability Modulo Theories Competition (SMT-COMP.pdf
- Design Methodology for Customizable Programmable Processors.ppt
- Detection of Near-IR CO Absorption Bands in R Coronae Borealis Stars.pdf
- Designing with care Adapting cultural probes to inform design in sensitive settings.pdf
- Determinants of a Digital Divide in Sub-Saharan Africa A Spatial Econometric Analysis of Cell Phone.pdf
- Developable Triangulations of a Strip.pdf
文档评论(0)