def select_sort(list):
for i in range(len(list)):
position = i
for j in range(i,len(list)):
if list[position] > list[j]:
position = j
temp = list[i]
list[i] = list[position]
list[pos...
分类:
编程语言 时间:
2014-08-12 17:25:34
阅读次数:
236
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
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
一、系统环境操作系统:centos6.4x86_64openssl版本:openssl-0.9.8e二、安装过程#tarzxvfopenssl-0.9.8e.tar.gz
#cdopenssl-0.9.8e
#./configsharedzlib
#make报错:md5-x86_64.s:41:Error:0xd76aa478outrangeofsigned32bitdisplacement
md5-x86_64.s:50:Error:0xe8c7b756outr..
分类:
其他好文 时间:
2014-08-08 18:24:26
阅读次数:
506
RMQ(Range Minimum/Maximum Query)问题是求区间最值问题。对于长度为 n 的数组 A,进行若干次查询,对于区间 [L,R] 返回数组A中下标在 [L,R] 中的最小(大)值。可以用线段树来解决这个问题,预处理的复杂度是 O(nlogn),查询的复杂度是 O(logn)。更...
分类:
其他好文 时间:
2014-08-08 17:34:26
阅读次数:
200
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string;{ //string就是此时输入的那个字符tex....
分类:
其他好文 时间:
2014-08-07 21:58:50
阅读次数:
198
1.MVC验证 1.1.验证方式 引入命名空间 using System.ComponentModel.DataAnnotations;定义验证规则:Model属性添加内置验证特性,介绍用的最多的其中的四个:[Required], [StringLength], [Range], 和 [Regula...
分类:
Web程序 时间:
2014-08-07 21:57:30
阅读次数:
369
1. python的generator是啥?
参见
https://wiki.python.org/moin/Generators
http://linuxgazette.net/100/pramode.html
就是一个能够当做iterator使用的function。例如如下常用的玩意
for i in range(10):
print i
2. 这东西难不难实现?
如果不允...
分类:
其他好文 时间:
2014-08-07 09:48:39
阅读次数:
255