<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:media="http://search.yahoo.com/mrss/"
	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>排序 - 四号程序员</title>
	<atom:link href="https://www.coder4.com/archives/tag/%E6%8E%92%E5%BA%8F/feed" rel="self" type="application/rss+xml" />
	<link>https://www.coder4.com</link>
	<description>Keep It Simple and Stupid</description>
	<lastBuildDate>Mon, 12 Jan 2015 12:18:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.3</generator>
	<item>
		<title>Python Sort多值排序</title>
		<link>https://www.coder4.com/archives/4372</link>
					<comments>https://www.coder4.com/archives/4372#respond</comments>
		
		<dc:creator><![CDATA[coder4]]></dc:creator>
		<pubDate>Mon, 12 Jan 2015 12:18:53 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[多值]]></category>
		<category><![CDATA[排序]]></category>
		<guid isPermaLink="false">http://www.coder4.com/?p=4372</guid>

					<description><![CDATA[假设使用lambda函数 s = sorted(s, key = lambda x: (x[1], x[2])) 如上所示，返回一个tuple，其中[0]是第1个排序key，[1]是第2个。[......] 继续阅读]]></description>
		
					<wfw:commentRss>https://www.coder4.com/archives/4372/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>MySQL中GROUP_CONCAT中排序</title>
		<link>https://www.coder4.com/archives/4176</link>
					<comments>https://www.coder4.com/archives/4176#respond</comments>
		
		<dc:creator><![CDATA[coder4]]></dc:creator>
		<pubDate>Wed, 09 Apr 2014 03:22:26 +0000</pubDate>
				<category><![CDATA[数据库技术]]></category>
		<category><![CDATA[By]]></category>
		<category><![CDATA[Group]]></category>
		<category><![CDATA[GROUP_CONCAT]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[排序]]></category>
		<guid isPermaLink="false">http://www.coder4.com/?p=4176</guid>

					<description><![CDATA[原来GROUP_CONCAT中，是支持GROUP内排序的，自己好土。。 SELECT student_name, GROUP_CONCAT(DISTINCT test_score ORDER BY test_score DESC SEPARATOR &#039; &#039;) FROM student GROUP BY student_name;[......] 继续阅读]]></description>
		
					<wfw:commentRss>https://www.coder4.com/archives/4176/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Linux sort的四个小技巧</title>
		<link>https://www.coder4.com/archives/2629</link>
					<comments>https://www.coder4.com/archives/2629#respond</comments>
		
		<dc:creator><![CDATA[coder4]]></dc:creator>
		<pubDate>Thu, 10 Nov 2011 06:27:00 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[sort]]></category>
		<category><![CDATA[列]]></category>
		<category><![CDATA[字典]]></category>
		<category><![CDATA[技巧]]></category>
		<category><![CDATA[指定]]></category>
		<category><![CDATA[排序]]></category>
		<category><![CDATA[数字]]></category>
		<guid isPermaLink="false">http://www.coder4.com/?p=2629</guid>

					<description><![CDATA[像排序这种事情，用C/C++可以写，但很麻烦，交给sort就好了，功能很强大的。 1、按照多个列排序（列间空格分开）： 测试数据： 先按照第1列排序，再第2列的命令： 2011-11-20补充：必须加-s选项，表示stable sort，即两列排序互相不打扰。 $ cat ./test 1       x 5       8 1       a $ sort -s -k 1 -k 2 ./test 1       a 1       x 5      [......] 继续阅读]]></description>
		
					<wfw:commentRss>https://www.coder4.com/archives/2629/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>算法技术手册 – 排序 – 如何选择排序算法</title>
		<link>https://www.coder4.com/archives/2309</link>
					<comments>https://www.coder4.com/archives/2309#respond</comments>
		
		<dc:creator><![CDATA[coder4]]></dc:creator>
		<pubDate>Sat, 08 Oct 2011 13:16:29 +0000</pubDate>
				<category><![CDATA[C && C++]]></category>
		<category><![CDATA[算法&数据结构]]></category>
		<category><![CDATA[排序]]></category>
		<category><![CDATA[排序算法]]></category>
		<category><![CDATA[算法技术手册]]></category>
		<category><![CDATA[选择]]></category>
		<guid isPermaLink="false">http://www.coder4.com/?p=2309</guid>

					<description><![CDATA[实际上，没有绝对优秀的、应该始终采用的排序算法。 书上给出了一些选择不同排序算法的理由，写的非常好，抄录一下。 元素很少：插入排序 几乎有序：插入排序 关注最差情况：堆排序（牢记：堆排序的最差时间复杂度依然是O(nlogn)） 平均较好：快速排序 元素从密集范围取出：桶排序 代码量小：插入排序 书上也在不同应用环境：字符串、浮点、几乎有序等情况下进行了测试，有兴趣的可以去翻阅。[......] 继续阅读]]></description>
		
					<wfw:commentRss>https://www.coder4.com/archives/2309/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>算法技术手册 – 排序 – 桶排序/哈希排序/散列排序</title>
		<link>https://www.coder4.com/archives/2301</link>
					<comments>https://www.coder4.com/archives/2301#comments</comments>
		
		<dc:creator><![CDATA[coder4]]></dc:creator>
		<pubDate>Sat, 08 Oct 2011 13:04:04 +0000</pubDate>
				<category><![CDATA[C && C++]]></category>
		<category><![CDATA[算法&数据结构]]></category>
		<category><![CDATA[哈希排序]]></category>
		<category><![CDATA[排序]]></category>
		<category><![CDATA[散列排序]]></category>
		<category><![CDATA[桶排序]]></category>
		<category><![CDATA[算法技术手册]]></category>
		<guid isPermaLink="false">http://www.coder4.com/?p=2301</guid>

					<description><![CDATA[在前面的计数排序中，我们已经领略到了如何用空间换时间的方法，找到一种线性时间复杂度O(N)的排序算法。 计数排序的缺点也是非常明显的：一旦数据范围[0,k)，中的k]相对于数据量N非常稀疏，计数排序的空间会非常大、时间消耗也会增大非常大。当然主要还是空间问题。 个人认为：桶排序 = 哈希排序 = 散列排序，基本思想是一样的。 于是桶排序/哈希排序应运而生，假设值域范围还是k，我们不去创建k个buckets，而是创建m个木桶，让N个元素通过哈系函数映射到这k个桶即可。这里还有一个[......] 继续阅读]]></description>
		
					<wfw:commentRss>https://www.coder4.com/archives/2301/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>算法技术手册 – 排序 – 计数排序</title>
		<link>https://www.coder4.com/archives/2284</link>
					<comments>https://www.coder4.com/archives/2284#respond</comments>
		
		<dc:creator><![CDATA[coder4]]></dc:creator>
		<pubDate>Sat, 08 Oct 2011 09:11:53 +0000</pubDate>
				<category><![CDATA[C && C++]]></category>
		<category><![CDATA[算法&数据结构]]></category>
		<category><![CDATA[排序]]></category>
		<category><![CDATA[算法技术手册]]></category>
		<category><![CDATA[计数排序]]></category>
		<guid isPermaLink="false">http://www.coder4.com/?p=2284</guid>

					<description><![CDATA[如果已知被排序的n个元素，值范围固定在在 "[0,k)"内]，那么计数排序是最好的选择，它具有线性复杂度。 这个约束有些过强，有些时候，可以将不满足这个条件的转化一下： 比如 [-k, k)映射]到[0, 2k)等]。 再比如1/p的小树映射到p k-p等等。 下面上算法，主要走两遍： 首先建立k个桶 (1)扫描n个元素，增加对应桶中的计数 (2)从小到大扫描k个桶，计数非零则减一，然后顺序、依次输出。 源代码： #include &#60;stdio.h&#62;[......] 继续阅读]]></description>
		
					<wfw:commentRss>https://www.coder4.com/archives/2284/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>算法技术手册 - 排序 - 堆排序</title>
		<link>https://www.coder4.com/archives/2182</link>
					<comments>https://www.coder4.com/archives/2182#respond</comments>
		
		<dc:creator><![CDATA[coder4]]></dc:creator>
		<pubDate>Tue, 20 Sep 2011 05:51:01 +0000</pubDate>
				<category><![CDATA[C && C++]]></category>
		<category><![CDATA[算法&数据结构]]></category>
		<category><![CDATA[堆排序]]></category>
		<category><![CDATA[排序]]></category>
		<category><![CDATA[算法技术手册]]></category>
		<guid isPermaLink="false">http://www.coder4.com/?p=2182</guid>

					<description><![CDATA[堆排序依赖于上午写道的构建堆和调整堆。 基本思想： (1)首先执行BuildHeap（以最大堆为例），则arr[0]已经是最大元素了，如果我们要按照从小到大排序，那么它应该被放在arr[n-1]上，于是，我们swap arr[0]和arr[n-1]。 (2)类似的，我们让i从n-1到0，依次执行调整堆，AdjustHeap(i,n)，每次调整完成后，堆顶部一定是最大元素，正好把他换到i-2上。 上述的思路和选择排序是不是非常相似！ 改进： 调整堆实际用到了递归方法，而其实它是[......] 继续阅读]]></description>
		
					<wfw:commentRss>https://www.coder4.com/archives/2182/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>算法技术手册 – 排序 – 选择排序</title>
		<link>https://www.coder4.com/archives/2167</link>
					<comments>https://www.coder4.com/archives/2167#respond</comments>
		
		<dc:creator><![CDATA[coder4]]></dc:creator>
		<pubDate>Sun, 18 Sep 2011 09:50:50 +0000</pubDate>
				<category><![CDATA[算法&数据结构]]></category>
		<category><![CDATA[实现]]></category>
		<category><![CDATA[排序]]></category>
		<category><![CDATA[算法技术手册]]></category>
		<category><![CDATA[选择排序]]></category>
		<guid isPermaLink="false">http://www.coder4.com/?p=2167</guid>

					<description><![CDATA[选择排序，思想非常简单，分为selectMax和selectSort两个部分。 selectMax： 每次选择区间内最大的数，返回其Index selectSort 1、从右到左依次扫描i（除idx=0，因为选到最后，最小的一定在最左边），规定区间为[0, i] 2、调用selectMax，获得最大的maxIndex。 3、这个i位置应该是第i大的数的位置，也就是maxIndex的数的位置，因此，如果i!=maxIndex，swap之。 算法复杂度，不管是最坏、平均还是最好[......] 继续阅读]]></description>
		
					<wfw:commentRss>https://www.coder4.com/archives/2167/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>算法技术手册 – 排序 – 划分</title>
		<link>https://www.coder4.com/archives/2148</link>
					<comments>https://www.coder4.com/archives/2148#respond</comments>
		
		<dc:creator><![CDATA[coder4]]></dc:creator>
		<pubDate>Sat, 17 Sep 2011 05:02:58 +0000</pubDate>
				<category><![CDATA[算法&数据结构]]></category>
		<category><![CDATA[划分]]></category>
		<category><![CDATA[排序]]></category>
		<category><![CDATA[算法技术手册]]></category>
		<guid isPermaLink="false">http://www.coder4.com/?p=2148</guid>

					<description><![CDATA[划分是求Kth、快速排序等的基础。 目标：一个数组array，给定一个pivotIndex，要求将array[pivotIndex]的对象至于storeIndex位置，使得[left,storeIndex)的元素都小于array[pivotIndex]，而使得大于[storeIndex,right]的元素都大于等于array[pivotIndex]。 算法步骤： 1、交换array[pivotIndex]和array[right]，记前者为pivot 2、用store表示pivo[......] 继续阅读]]></description>
		
					<wfw:commentRss>https://www.coder4.com/archives/2148/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>算法技术手册 - 排序 - 插入排序</title>
		<link>https://www.coder4.com/archives/2146</link>
					<comments>https://www.coder4.com/archives/2146#respond</comments>
		
		<dc:creator><![CDATA[coder4]]></dc:creator>
		<pubDate>Fri, 16 Sep 2011 13:08:18 +0000</pubDate>
				<category><![CDATA[算法&数据结构]]></category>
		<category><![CDATA[排序]]></category>
		<category><![CDATA[插入排序]]></category>
		<category><![CDATA[算法技术手册]]></category>
		<guid isPermaLink="false">http://www.coder4.com/?p=2146</guid>

					<description><![CDATA[插入排序： 类似洗牌，将从1~N的数字分别插入到合适的位置，当然对于数组来说，需要做相应的移动。基础的方法是依次挪动，较为快捷的方法是memmove。 需要说明的是，按照Linux的man手册，memmove是支持内存overlap的，即可以部分重叠，函数内部会处理好其他的事情，因此类似书上的先移动到buffer，再从buffer移动到另一个位置是没必要的！ #include &#60;stdio.h&#62; #include &#60;string.h&#62; typedef[......] 继续阅读]]></description>
		
					<wfw:commentRss>https://www.coder4.com/archives/2146/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
