摘要: void InsertionSort(int arr[]) { for(int i=1; i 0) { //move key to previous position arr[j] = arr[j-1]; j--; } arr[j] = key; ... 阅读全文
posted @ 2017-09-10 19:59 推杯问盏 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 1、类的定义 private&protected 成员不能从外部进行访问 public 成员可以从外部进行访问 例如: 如果在类体起始点无访问说明符,系统默认为私有(private) 2、成员函数的定义 通常在类的定义中,成员函数仅作说明,函数定义通常在类的说明之后进行,格式如下: 3、类成员的访问 阅读全文
posted @ 2017-09-10 14:28 推杯问盏 阅读(262) 评论(0) 推荐(0) 编辑
摘要: from numpy import exp, array, random, dot class NeuralNetwork(): def __init__(self): random.seed(1) self.synaptic_weights = 2 * random.random((3,1)) - 1 def __sigmoid(se... 阅读全文
posted @ 2017-09-10 10:11 推杯问盏 阅读(396) 评论(0) 推荐(0) 编辑
摘要: import os # 查找当前目录下所有包含关键字的文件 def findFile(path, filekw): return[os.path.join(path,x) for x in os.listdir(path) if os.path.isfile(x) and os.path.split(x)[1].find(filekw)>-1] # 获取指定目录下的次级目录 def... 阅读全文
posted @ 2017-09-10 10:00 推杯问盏 阅读(508) 评论(0) 推荐(0) 编辑