quicksort.html

来自「数据结构词典(英文)」· HTML 代码 · 共 52 行

HTML
52
字号
<!DOCTYPE HTML PUBLIC "-//IETF//DTD W3 HTML 2.0//EN">
<HTML lang="en-US">
<HEAD>
<TITLE>quicksort</TITLE>
<META name="description"
  content="Definition of quicksort,
	possibly with links to more information and implementations.">
<META name="keywords" content="quicksort">
</HEAD>
<BODY BGCOLOR="#FFFFFF">

<H1>quicksort</H1>
<P>
(algorithm)

<P>
<strong>Definition:</strong>
An <a href="inplacesort.html" tppabs="http://hissa.nist.gov/dads/HTML/inplacesort.html"><em>in-place sort</em></a> algorithm that uses the <a href="divideconqr.html" tppabs="http://hissa.nist.gov/dads/HTML/divideconqr.html"><em>divide and conquer</em></a> paradigm.  It picks an element from the array (the pivot), partitions the remaining elements into those greater than and less than this pivot, and <a href="recursion.html" tppabs="http://hissa.nist.gov/dads/HTML/recursion.html"><em>recursively</em></a> sorts the partitions. There are many variants of the basic scheme above: to select the pivot, to partition the array, to stop the recursion on small partitions, etc.
<P><strong>See also</strong>
<a href="balancedqsrt.html" tppabs="http://hissa.nist.gov/dads/HTML/balancedqsrt.html"><em>balanced quicksort</em></a>, <a href="sort.html" tppabs="http://hissa.nist.gov/dads/HTML/sort.html"><em>sort</em></a>.
<P><em>Note:
Quicksort has worst-case running time  <a href="bigOnotation.html" tppabs="http://hissa.nist.gov/dads/HTML/bigOnotation.html"><em>O(n<sup>2</sup>)</em></a>, but it is typically O(n log n).  In practical situations, a finely tuned implementation of quicksort beats most sort algorithms, including sort algorithms whose theoretical complexity is O(n log n) in the worst case.   <P> The <a href="dutchnatlflg.html" tppabs="http://hissa.nist.gov/dads/HTML/dutchnatlflg.html"><em>Dutch National Flag</em></a> algorithm partitions quickly when there are many duplicates.</em>
<P>Author: <a href="terms.html#authorCM" tppabs="http://hissa.nist.gov/dads/terms.html#authorCM">CM</a>
<H2>Implementation</H2>
<A HREF="javascript:if(confirm('http://www.nist.gov/cgi-bin/exit_nist.cgi?url=http://www.cs.ubc.ca/spider/harrison/Java/QSortAlgorithm.java  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?'))window.location='http://www.nist.gov/cgi-bin/exit_nist.cgi?url=http://www.cs.ubc.ca/spider/harrison/Java/QSortAlgorithm.java'" tppabs="http://www.nist.gov/cgi-bin/exit_nist.cgi?url=http://www.cs.ubc.ca/spider/harrison/Java/QSortAlgorithm.java">(Java)</A>.
<H2>More information</H2>
<A HREF="javascript:if(confirm('http://www.nist.gov/cgi-bin/exit_nist.cgi?url=http://www.cs.ubc.ca/spider/harrison/Java/sorting-demo.html  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?'))window.location='http://www.nist.gov/cgi-bin/exit_nist.cgi?url=http://www.cs.ubc.ca/spider/harrison/Java/sorting-demo.html'" tppabs="http://www.nist.gov/cgi-bin/exit_nist.cgi?url=http://www.cs.ubc.ca/spider/harrison/Java/sorting-demo.html">demonstration</A>.

<hr>

Go to the
<A HREF="terms.html" tppabs="http://hissa.nist.gov/dads/terms.html">Algorithms, Data Structures, and Problems</A>
home page.

<hr>

If you have suggestions, corrections, or comments, please get in touch
with
<a href="javascript:if(confirm('http://hissa.nist.gov/~black/black.html  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?'))window.location='http://hissa.nist.gov/~black/black.html'" tppabs="http://hissa.nist.gov/~black/black.html">Paul E. Black</a>
&nbsp;(<a href="mailto:paul.black@nist.gov">paul.black@nist.gov</a>).

<p>
Entry modified Thu Nov 18 13:28:45 1999.<BR>
HTML page formatted Wed Dec 22 09:36:17 1999.

<P>
This page's URL is
<A href="quicksort.html" tppabs="http://hissa.nist.gov/dads/HTML/quicksort.html">http://hissa.nist.gov/dads/HTML/quicksort.html</A>

</BODY>
</HTML>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?