<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>一花一世界 &#187; 计数排序</title>
	<atom:link href="http://www.juliuschen.com/archives/tag/%e8%ae%a1%e6%95%b0%e6%8e%92%e5%ba%8f/feed" rel="self" type="application/rss+xml" />
	<link>http://www.juliuschen.com</link>
	<description></description>
	<lastBuildDate>Mon, 17 Oct 2011 10:30:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>计数排序</title>
		<link>http://www.juliuschen.com/archives/14.html</link>
		<comments>http://www.juliuschen.com/archives/14.html#comments</comments>
		<pubDate>Thu, 24 Dec 2009 10:34:17 +0000</pubDate>
		<dc:creator>Julius Chen</dc:creator>
				<category><![CDATA[Sorting]]></category>
		<category><![CDATA[排序算法]]></category>
		<category><![CDATA[计数排序]]></category>
		<category><![CDATA[非比较排序]]></category>

		<guid isPermaLink="false">http://www.juliuschen.com/archives/14</guid>
		<description><![CDATA[计数排序(Counting Sort)是一种非基于比较的排序方法，它要求所有的待排元素都必须是≥0的整数。它的排序步骤是首先根据数组中最大的元素值加1作为长度来定义一个计数数组C。然后统计待排数组中每个值为i的元素出现的次数，存入C的第i项中。再对所有的计数累加（从C中的第一项开始，每一项和前一项相加）。最后再反向填充辅助数组：将每个元素i放在辅助数组的第C(i)项，每放一个元素就将C(i)减去1。这样完成之后排序就已完毕，有序序列已存储在辅助数组中。如果结果想用原数组输出，则将它们从辅助数组考回到原数组即可。 计数排序的C/C++代码实现： 计数排序是稳定的排序方法，这是它很重要的特性之一，也是为什么要在这里介绍它的原因：因为后面的LSD基数排序会因为它的这个特性而用到它。 计数排序的时间复杂度是O(n)，比之前所讲的所有比较排序算法都快。但由于它的限制条件苛刻，比如所排元素必须是≥0的正整数，并且数据范围和数据元素个数不宜过大等。虽然经过改进可以对数据项较大、包含范围较小的文件进行排序，但应用范围仍然不是很大。]]></description>
		<wfw:commentRss>http://www.juliuschen.com/archives/14.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- www.000webhost.com Analytics Code -->
<script type="text/javascript" src="http://analytics.hosting24.com/count.php"></script>
<noscript><a href="http://www.hosting24.com/"><img src="http://analytics.hosting24.com/count.php" alt="web hosting" /></a></noscript>
<!-- End Of Analytics Code -->

