码迷,mamicode.com
首页 >  
搜索关键字:awk sort    ( 17174个结果
[leetcode]Insertion Sort List @ Python
原题地址:http://oj.leetcode.com/problems/insertion-sort-list/题意:对链表进行插入排序。解题思路:首先来对插入排序有一个直观的认识,来自维基百科。 代码循环部分图示:代码:class Solution:# @p...
分类:编程语言   时间:2014-07-22 23:11:32    阅读次数:411
计算字符串中每个字符出现次数
作者:zccst思想原理:把字符串分割为数组,粒度为每一个字符。循环该数组,用正则替换原字符串对于字符,并计算替换前后字符串长度差值,即为该字符出现的次数。另外,还可以对重复次数进行排序。用到的知识点:1,正则表达式。基本写法,RegExp,replace的用法。2,数组中的sort。自定义函数排序...
分类:其他好文   时间:2014-05-01 14:49:08    阅读次数:376
全排列
#include#include#includeusing namespace std;int main(){ int n,i; char a[100000]; cin>>a; sort(a,a+strlen(a)); do{ cout<<a<<endl; }while(next_permut...
分类:其他好文   时间:2014-05-01 06:20:37    阅读次数:368
c++ ACM常用函数
1 保留小数点后两位#include cout const char * spilt="/";char *p;p=strtok(str,spilt);while(p!=NULL){ //cout #includesort(Rs.begin(),Rs.end());sort(Rs.begin(),Rs...
分类:编程语言   时间:2014-05-01 05:05:45    阅读次数:409
快速排序
package algorithm.sort;public class QuickSort { public static void main(String[] args) { int[] a = new int[] {5, 3, 7, 2, 1, 4, 9, 8, 6, 1}; sort(a); ...
分类:其他好文   时间:2014-05-01 03:33:20    阅读次数:330
计数排序
package algorithm.sort;public class CountingSort { public static void main(String[] args) { int[] a = new int[] {5, 3, 7, 2, 1, 4, 9, 8, 6, 1}; int[] ...
分类:其他好文   时间:2014-05-01 03:25:05    阅读次数:252
堆排序
package algorithm.sort;public class HeapSort { public static void main(String[] args) { int[] a = new int[] {5, 3, 7, 2, 1, 4, 9, 8, 6, 1}; sort(a); p...
分类:其他好文   时间:2014-05-01 03:24:04    阅读次数:332
stable_sort() 和 sort() 的区别
1.stable_sort 和 sort的区别在于 前者作排序可以使原来的"相同"的值在序列中的相对位置不变 如 1 4 6 7 4' (4 和 4'值相等,加上' 表示是2个元素) 那么stable_sort能保证排序完 4 仍然在4' 前 也就是输出1 4 4' 6 7;但是sort 没有这个功能,算法不能保证这一点 2.在标准算法中的一部分算法 如果这个算法默认使用的是 ...
分类:其他好文   时间:2014-04-29 13:45:20    阅读次数:273
排序算法-冒泡——插入——快排
冒泡排序,往两个方向泡,一个往小泡,一个网大泡 #include #include #include void bubble_sort(int *a,int n){ int temp; for(int i=0;i<n;i++) for(int j=0;ja[j+1]){ temp=a[j]; a[j]=a[j+1]; ...
分类:其他好文   时间:2014-04-29 13:28:21    阅读次数:364
C++ Primer 学习笔记_46_STL实践与分析(20)--容器特有的算法
STL实践与分析--容器特有的算法    与其他顺序容器所支持的操作相比,标准库为list容器定义了更精细的操作集合,使它不必只依赖于泛型操作。其中很大的一个原因就是list容器不是按照内存中的顺序进行布局的,不支持随即访问,这样,在list容器上就不能使用随即访问迭代器的算法,如sort等;还有其他的一些算法如:merge、remove、reverse和unique,虽然可以用在list上,但却...
分类:编程语言   时间:2014-04-27 21:45:04    阅读次数:474
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!