码迷,mamicode.com
首页 >  
搜索关键字:sort    ( 12890个结果
Sort Colors
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, ...
分类:其他好文   时间:2014-08-24 11:32:02    阅读次数:164
python排序
import mathclass sort: def selectSort(self, L): size = len(L) for i in range(0, size): max = L[i] index = i ...
分类:编程语言   时间:2014-08-23 22:48:11    阅读次数:205
C#里List.Sort的用法
using System;using System.Collections.Generic;using System.Linq;using System.Text; namespace ListSort{ class Program { static void Main(s...
分类:其他好文   时间:2014-08-22 23:43:59    阅读次数:233
Java 全排列
package algorithm; public class SortAll { public static void main(String[] args) { char buf[] = {'1','2','3','4','5'}; perm(buf,0,buf.length-1); } private static void perm(char[] buf, int sta...
分类:编程语言   时间:2014-08-22 17:56:39    阅读次数:233
看我linux如何防SYN攻击
[root@web~]#netstat-anp|awk‘{print$6}‘|sort|uniq-c|sort-rn172ESTABLISHED59CONNECTED589SYN_RECV15STREAMSYN居然这么高,继续追查是那些ip发出的SYN:[root@tweb~]#netstat-an|grepSYN|awk‘{print$5}‘|awk-F:‘{print$1}‘|sort|uniq-c|sort-nr|more570x.x.x.x(ip就不写出了..
分类:系统相关   时间:2014-08-21 19:35:16    阅读次数:305
[LeetCode蠕动系列]Sort List
这题前一阵子就看到了,一直没时间做,昨晚睡前想了想,要求n*log(n)以内的时间复杂度,第一时间想到的就是归并、快排和希尔排序(注:希尔排序时间为O(n^1.3),在数据量大于2的情况下小于n*log(n)),个人以为,链表的特性更适合归并,所以采用归并排序,实现的merge代码如下:publ.....
分类:其他好文   时间:2014-08-21 19:01:54    阅读次数:226
排序算法总结之冒泡排序
冒泡排序(Bubble Sort,台湾译为:泡沫排序或气泡排序)是一种简单的排序算法。它的基本思想就是两两比较相邻记录的关键字,如果反序则交换,直到没有反序的记录为止。它重复地走访过要排序的数列,一次比较两个元素,如果他们的顺序错误就把他们交换过来。走访数列的工作是重复地进行直到没有再需要交换,也就是说该数列已经排序完成。 例如:初始序列3,6,4,2,11,10,5;从头开始,两两相比...
分类:其他好文   时间:2014-08-21 15:07:44    阅读次数:188
【Leet Code】Median of Two Sorted Arrays
Median of Two Sorted Arrays  Total Accepted: 17932 Total Submissions: 103927My Submissions There are two sorted arrays A and B of size m and n respectively. Find the median of the two sort...
分类:其他好文   时间:2014-08-21 13:24:54    阅读次数:206
java四种数组排序
数组的四种排序1.快速排序法Arrays.sort();用法1.sort(byte[] a) 对指定的 byte 型数组按数字升序进行排序。 sort(byte[] a, int fromIndex, int toIndex) 对指定 byte 型数组的指定范围按数字升序进行排序。 sort(...
分类:编程语言   时间:2014-08-21 11:21:53    阅读次数:288
[7] 算法之路 - 快速排序之3轴演算
左轴演算、中轴演算、右轴演算 题目: 快速排序法(quick sort)是目前所公认最快的排序方法之一(视解题的对象而定),虽然快速排序法在最差状况下可以达O(n2),但是在多数的情况下,快速排序法的效率表现是相当不错的。 快速排序 - 算法 1、快速排序法的基本精神是在数列中找出适当的轴心,然后将数列一分为二 2、分别对左边与右边数列进行排序...
分类:其他好文   时间:2014-08-21 01:38:43    阅读次数:155
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!