def insert_sort(list):
for i in range(len(list)):
while i > 0 and list[i] < list[i-1]:
temp = list[i]
list[i] = list[i-1]
list[i-1] = temp
i = i-1...
分类:
编程语言 时间:
2014-08-12 17:25:24
阅读次数:
269
在Python中没有switch语句If语句if condition:do sthelif condition: Do sthelse: Do sthwhile语句有一个可选的else从句while condition: do sthelse: do sthfor循环for i in range(1...
分类:
编程语言 时间:
2014-08-12 16:38:44
阅读次数:
193
(define (range n) (define (recur n) (if (= n -1) '() (cons n (recur (- n 1))))) (recur (- n 1)))(define (flatten a)...
分类:
其他好文 时间:
2014-08-12 16:24:34
阅读次数:
183
将大小王看成0
排序 然后求出0的个数 如果0的个数大于差值且不为对子就返回true
#include
//n张牌判断是否是顺子
using namespace std;
int partition(int *number,int start,int end){
int temp = number[start];
while(start < end){
while(start ...
分类:
其他好文 时间:
2014-08-12 13:38:24
阅读次数:
142
快速排序递归实现,队列实现,栈实现,partition实现...
分类:
其他好文 时间:
2014-08-11 21:35:52
阅读次数:
275
import osimport sysimport structdef enc(path, key): path_ret = "" for i in range(0, len(path)/4): path_ret += struct.pack(">> ===========...
分类:
编程语言 时间:
2014-08-11 11:27:22
阅读次数:
2362
1 //数组中两个数的交换 2 static void swap(int[] nums, int pos1, int pos2){ 3 int temp = nums[pos1]; 4 nums[pos1] = nums[pos2]; 5 n...
分类:
其他好文 时间:
2014-08-10 21:25:50
阅读次数:
308
A so juicy and interesting problem! Recommend to everyone!A final solution may not jump into your mind immediately, of course, DP is not a trivial top...
分类:
其他好文 时间:
2014-08-10 15:37:00
阅读次数:
209
Partition
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2472 Accepted Submission(s): 978
Problem Description
Define f(n) as th...
分类:
其他好文 时间:
2014-08-10 13:00:20
阅读次数:
194
oracle 里面经常这样用select col1,col2..., row_number() over (partition by colx order by coly) from table_name;;这句话的意思是把表中的数值按照colx 分组,每一组内部按照coly排序,同时 row_nu...
分类:
数据库 时间:
2014-08-08 20:40:56
阅读次数:
307