- 博客(18)
- 资源 (3)
- 收藏
- 关注
原创 python线程
import threadingimport timeimport random#生产者class Producer(threading.Thread): def __init__(self, threadName, shareObject): threading.Thread.__init__(self, name = threadName)
2010-03-26 16:11:00 924
原创 python学习3-使用dict
#构造d = dict(one = 33, two = 44)print(d)d0 = dict({one : 55, two : 66})print(d0)d1 = dict(zip((one, two), (77, 88)))print(d1)d2 = dict([(one, 3), (two, 4)])print(d2)d3 = {
2010-03-20 15:23:00 2370
原创 python学习2-使用list
# 0 1 2 3 4 5 6# -7 -6 -5 -4 -3 -2 -1a = [1, 2, 3, 4, 5, 6, 7]#子list提取#起始位置:结束位置(不包括结束位置的元素)b = a[1:4]print(b)#默认是最后一个元素的下一位(好比C++的迭代器)c = a[1:]print(c)d = a[1:-1]prin
2010-03-19 10:04:00 709
原创 python学习1-使用类
#使用类class CPerson: #类变量好比C++中的静态成员变量 population = 0 def SayHi(self): print(Hello World) def HowMany(self): if CPerson.population == 1: prin
2010-03-18 11:32:00 1027
原创 单例模式的一种实现方法
class CSingleton{private: /* 禁掉构造函数 拷贝构造函数 */ CSingleton(void); CSingleton(const CSingleton& oth);public: static CSingleton& Instance(void) { static CSingleton s_singleton; retur
2010-03-16 21:18:00 1407
原创 python算法实践7-归并排序
def MergeSort(mylist, low, mid, high): i = low j = mid + 1 tmp = [] while i <= mid and j <= high: if mylist[i] <= mylist[j]: tmp.append(mylist[i])
2010-03-16 17:09:00 1160 2
原创 python算法实践6-堆排序
#堆排序def Heapify(mylist, start, end): left = 0 right = 0 maxv = 0 left = start * 2 right = start * 2 + 1 while left <= end: maxv = left if right <= end
2010-03-16 16:21:00 1822
原创 python算法实践5-直接选择排序
#直接选择排序def SelectSort(mylist): size = len(mylist) i = 0 for i in range(0, size): k = i for j in range(i + 1, size): if mylist[j] < mylist[k]:
2010-03-16 15:24:00 1126
原创 python算法实践4-快速排序
#快速排序def Partition(mylist, low, high): tmp = mylist[low] while low < high: while low = tmp: high = high - 1 if low < high: mylist[low] = mylist[
2010-03-16 15:03:00 1880
原创 python算法实践3-冒泡排序
#冒泡排序def BubbleSort(mylist): n = len(mylist) i = 0 j = 0 bExchange = False for i in range(1, n): bExchange = False j = n - 1 while j >= i:
2010-03-16 14:08:00 1577
原创 python算法实践2-shell排序
#shell排序def ShellPass(mylist, d): size = len(mylist) i = d while i < size: if mylist[i] < mylist[i - d]: tmp = mylist[i] j = i - d myli
2010-03-16 11:45:00 866
原创 python算法实践1-直接插入排序
# 直接插入排序def InsertSort(mylist): size = len(mylist) i = 1 for i in range(1, size): if mylist[i] < mylist[i - 1]: tmp = mylist[i] j = i - 1
2010-03-16 10:22:00 1822
原创 stack使用
// stackTest.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include #include #include using namespace std; /* stack是一个后进先出操作元素
2010-03-09 17:12:00 1925
原创 map使用
// mapTest.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include #include using namespace std;/*template ,class Allocator = allocator > > class map;
2010-03-05 21:24:00 1236
原创 priority_queue使用
// priority_queueTest.cpp : Defines the entry point for the console application.// #include "stdafx.h"#include #include using namespace std;/*template class Compare = less > class p
2010-03-05 17:17:00 1025
转载 怎样学习编程
高质量自然是程序员的技术追求,也是职业道德的要求。宁可进度慢些,也要保证每个环节的质量,以图长远利益。人员管理,项目管理,可行性与需求分析,系统设计,程序设计,测试。软件开发中的三种基本策略:“复用”、“分而治之”、“优化——折衷”。进步是应该的,但不进步则是可耻的。在一个新系统中,大部分的内容是成熟的,只有小部分内容是创新的。
2010-03-05 13:35:00 927
原创 deque使用
// dequeTest.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include #include using namespace std; /* 双端队列 */ /
2010-03-04 11:04:00 1396
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人