📄 selectnpart.html
字号:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD W3 HTML 2.0//EN">
<HTML lang="en-US">
<HEAD>
<TITLE>select and partition</TITLE>
<META name="description"
content="Definition of select and partition,
possibly with links to more information and implementations.">
<META name="keywords" content="select and partition">
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<H1>select and partition</H1>
<P>
(classic problem)
<P>
<strong>Definition:</strong>
Given an <a href="array.html" tppabs="http://hissa.nist.gov/dads/HTML/array.html"><em>array</em></a> A of <em>n</em> elements and a positive integer k <img src="leq.gif" tppabs="http://hissa.nist.gov/dads/HTML/Images/leq.gif" border=0 height=7 width=14 alt="less than or equal to"> n, find the <em>k<sup>th</sup></em> smallest element of A and <a href="partition.html" tppabs="http://hissa.nist.gov/dads/HTML/partition.html"><em>partition</em></a> the array such that A[1], ..., A[k-1] <img src="leq.gif" tppabs="http://hissa.nist.gov/dads/HTML/Images/leq.gif" border=0 height=7 width=14 alt="less than or equal to"> A[k] <img src="leq.gif" tppabs="http://hissa.nist.gov/dads/HTML/Images/leq.gif" border=0 height=7 width=14 alt="less than or equal to"> A[k+1], ..., A[n].
<P><strong>See also</strong>
<a href="modifind.html" tppabs="http://hissa.nist.gov/dads/HTML/modifind.html"><em>MODIFIND</em></a>, <a href="find.html" tppabs="http://hissa.nist.gov/dads/HTML/find.html"><em>Find</em></a>, <a href="selectkth.html" tppabs="http://hissa.nist.gov/dads/HTML/selectkth.html"><em>select k<sup>th</sup> element</em></a>.
<P><em>Note:
Algorithms to solve this problem are often used in <a href="sort.html" tppabs="http://hissa.nist.gov/dads/HTML/sort.html"><em>sort</em></a> algorithms. Implementations have been published by C. A. R. Hoare (Algorithm 65, <a href="find.html" tppabs="http://hissa.nist.gov/dads/HTML/find.html"><em>Find</em></a>, CACM, Vol. 4, No. 7, July 1961, page 321), R. W. Floyd and R. L. Rivest (CACM, Vol. 18, No. 3, March 1975, page 173), and Vladimir Zabrodsky (<a href="modifind.html" tppabs="http://hissa.nist.gov/dads/HTML/modifind.html"><em>MODIFIND</em></a>, Elektronika, No. 6, 1992, pages 33-34). These can be easily changed to find the k<sup>th</sup> largest element.</em>
<P>Author: <a href="terms.html#authorVZ" tppabs="http://hissa.nist.gov/dads/terms.html#authorVZ">VZ</a>
<H2>Implementation</H2>
<A HREF="javascript:if(confirm('http://www.nist.gov/cgi-bin/exit_nist.cgi?url=http://www.geocities.com/SiliconValley/Garage/3323/3alg.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.geocities.com/SiliconValley/Garage/3323/3alg.html'" tppabs="http://www.nist.gov/cgi-bin/exit_nist.cgi?url=http://www.geocities.com/SiliconValley/Garage/3323/3alg.html">analysis and comparison (Rexx)</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>
(<a href="mailto:paul.black@nist.gov">paul.black@nist.gov</a>).
<p>
Entry modified Tue Jun 8 12:06:17 1999.<BR>
HTML page formatted Wed Dec 22 09:36:25 1999.
<P>
This page's URL is
<A href="selectnpart.html" tppabs="http://hissa.nist.gov/dads/HTML/selectnpart.html">http://hissa.nist.gov/dads/HTML/selectnpart.html</A>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -