码迷,mamicode.com
首页 >  
搜索关键字:sort    ( 12890个结果
hdu 5175 Misaki's Kiss again(GCD和异或)
题意:给一个数N。如果GCD(N,M) = N XOR M,则称M是一个kiss 10 && x0 && xx0){ sort(ans+1,ans+1+kissNum); printf("%I64d",ans[1]); re...
分类:其他好文   时间:2015-02-28 01:34:26    阅读次数:193
C++ 排序函数 sort(),qsort()的含义与用法 ,字符串string 的逆序排序等
上学时我们很多学了很多种排序算法,不过在c++stl中也封装了sort等函数,头文件是#include 函数名功能描述sort对给定区间所有元素进行排序stable_sort对给定区间所有元素进行稳定排序partial_sort对给定区间所有元素部分排序partial_sort_copy对给定区间复...
分类:编程语言   时间:2015-02-27 16:25:48    阅读次数:187
Bash下的实用小脚本(不定期更新)
1、lnoi.sh:列出当前系统下每个IP的连接数:#catlnoi.sh#!/bin/bash #UseforlistconnectnumbersandIPaddress. netstat-n|grep‘^tcp‘|grep-v‘127.0.0.1‘|awk‘{print$5}‘|cut-d:-f1|sort|uniq-c|sort-rn|awk‘BEGIN{printf"%-10s%s\n","ConNum","IP"}{printf"%-11s%s\n",$1,$2}..
分类:其他好文   时间:2015-02-27 01:38:42    阅读次数:208
数组常见的操作_选择排序
排序分类: 内部排序:就是将需要处理的所有数据都加载到内部存储器中进行排序 交换式排序法:是运用数值较后,依判断规则对数据位置进行交换,以达到排序的目的冒泡排序法(Bubble Sort)快速排序法(Quick Sort) 选择式排序法:选择排序法(Select Sort) 堆排序法(Heap S....
分类:编程语言   时间:2015-02-26 21:26:49    阅读次数:156
Algorithm: quick sort implemented in python 算法导论 快速排序
1 import random 2 3 def partition(A, lo, hi): 4 pivot_index = random.randint(lo, hi) 5 pivot = A[pivot_index] 6 A[pivot_index], A[hi] = ...
分类:编程语言   时间:2015-02-26 14:51:41    阅读次数:183
CC150 : Sort Stack
可以使用一个extra的stack。 1 class Solution { 2 public Stack sortStack(Stack s1) { 3 Stack s2 = new Stack(); 4 while(!s1.isEmpty()) { 5 ...
分类:其他好文   时间:2015-02-26 09:48:17    阅读次数:127
leetcode 75. Sort Colors
Given an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, wh...
分类:其他好文   时间:2015-02-25 23:37:22    阅读次数:140
algorithm: heap sort in python 算法导论 堆排序
An Python implementation of heap-sortbased on the detailed algorithm description in Introduction to Algorithms Third Editionimport randomdef max_heap....
分类:编程语言   时间:2015-02-25 22:19:46    阅读次数:185
NYOJ 233 &&NYOJ 322 Sort(树状数组)
链接:click here 题意: 描述 You want to processe a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted in ascending order. Then how many times it nee...
分类:编程语言   时间:2015-02-25 21:10:08    阅读次数:153
Binary Tree
Binary Tree dfs Traversal-preorder/inorder/postorder-divide&conquer-introduce dfs templatePreorder :Inorder;Postorder:Divide & Conquer :-Merge Sort (a...
分类:其他好文   时间:2015-02-25 11:38:00    阅读次数:123
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!