1 Arrays.sort(points, new comparator());2 3
public static class comparator implements Comparator {4 public int compare(Point
p1, Point p2) {5 ...
分类:
编程语言 时间:
2014-05-05 23:32:10
阅读次数:
444
#include #include int
a[]={10,22,42,51,56,63,78,99,102,118}; int binSearch(int* a, int begin, int end,
int k){ int mid = begin + ( (end - be...
分类:
其他好文 时间:
2014-05-05 23:31:39
阅读次数:
257
1. 快速排序不稳定的排序。2. 希尔排序直接插入排序的改进,是稳定的排序。3.
直接插入排序稳定的排序。
分类:
其他好文 时间:
2014-05-05 23:12:36
阅读次数:
246
http://www.oschina.net/question/100267_61129?sort=default&p=1#tags_navhttp://www.cnblogs.com/top5/archive/2011/12/29/2306241.htmlhttp://www.open-open....
分类:
移动开发 时间:
2014-05-05 22:49:04
阅读次数:
417
用 'top -i' 看看有多少进程处于 Running 状态,可能系统存在内存或 I/O 瓶颈,用 free 看看系统内存使用情况,swap 是否被占用很多,用 iostat 看看 I/O 负载情况...
还有一种办法是 ps -ef | sort -k7 ,将进程按运行时间排序,看哪个进程消耗的cpu时间最多。
top:
主要参数
d:指定更新的间隔,以秒计算。
q:没有任何延迟...
分类:
系统相关 时间:
2014-05-05 13:09:00
阅读次数:
526
void Merge(int A[],int p,int q,int r){
int i,j,k;
//计算子数组A[p..q]的元素个数
int n1 = q - p + 1;
//计算子数组A[q+1..r]元素个数
int n2 = r - q;
//创建子数组L,R
int* L = (int*)malloc(sizeof(int)*...
分类:
其他好文 时间:
2014-05-04 12:44:38
阅读次数:
384
题意不说了,说下思路。
给出的关系是a要求的工资要比b的工资多,由于尽可能的让老板少付钱,那么a的工资就是b的工资+1,可以确定关系为a>b,根据拓扑排序建边的原则是把“小于”关系看成有向边,那么我们可以建边v->u。
#include
#include
#include
#include
#include
#include
#include
#include
#inclu...
分类:
其他好文 时间:
2014-05-04 00:06:31
阅读次数:
271
Input
t – the number of numbers in list, then t lines follow [t
Each line contains one integer: N [0 N
Output
Output given numbers in non decreasing order.
Example
Input:
5
5
3
...
分类:
其他好文 时间:
2014-05-04 00:04:09
阅读次数:
376
list1 = [ 4, 7, 7, 3, 3, 3, 2, 1 ]
list2 = [ 5, 4, 3, 3, 2, 2, 2, 1, 1, 1 ]
def havel_hakimi_algo( degree_list ):
degree_list.sort( reverse = True )
print degree_list
for degr...
分类:
编程语言 时间:
2014-05-03 17:13:49
阅读次数:
426
概念
优先级队列,顾名思义,就是一种根据一定优先级存储和取出数据的队列。它可以说是队列和排序的完美结合体,不仅可以存储数据,还可以将这些数据按照我们设定的规则进行排序。优先级队列是堆的一种常见应用。有最大优先级队列(最大堆)和最小优先级队列(最小堆)。优先级队列是一种维护有一组元素构成的集合S的数据结构。
优先队列支持的基本运算
[cpp] view
plai...
分类:
其他好文 时间:
2014-05-03 17:00:11
阅读次数:
341