Click to Visit Homepage : zzyzz.top


02 2018 档案

摘要:1 Thread Based Parallelism - Thread Synchronization With Lock 2 3 import threading 4 5 shared_resource_with_lock = 0 6 shared_resource_with_no_lock = 0 7 COUNT = 100000 8 ... 阅读全文
posted @ 2018-02-09 17:56 zzYzz 阅读(182) 评论(0) 推荐(0) 编辑
摘要:1 Thread Based Parallelism - Thread Synchronization With a Condition 2 3 from threading import Thread, Condition 4 import time 5 6 items = [] 7 condition = Condition()... 阅读全文
posted @ 2018-02-08 15:59 zzYzz 阅读(208) 评论(0) 推荐(0) 编辑
摘要:Thread Based Parallelism - Thread in a Subclass 1 import threading 2 import time 3 4 exit_Flag = 0 5 6 class myThread (threading.Thread): 7 def __init__(self, th... 阅读全文
posted @ 2018-02-08 15:18 zzYzz 阅读(138) 评论(0) 推荐(0) 编辑
摘要:1 The divide and conquer approach - 归并排序 2 归并排序所应用的理论思想叫做分治法. 3 分治法的思想是: 将问题分解为若干个规模较小,并且类似于原问题的子问题, 4 然后递归(recursive) 求解这些子问题, 最后再合并这些子问题的解以求得 5 原问题的解. 6 即, 分解 ->... 阅读全文
posted @ 2018-02-08 11:59 zzYzz 阅读(496) 评论(0) 推荐(0) 编辑
摘要:1 Insertion Sort - 插入排序 2 插入排序算法的 '时间复杂度' 是输入规模的二次函数, 深度抽象后表示为, n 的二次方. 3 4 import time, random 5 F = 0 6 alist = [] 7 while F 0: 19 i -= 1 20 if alist[i] > fact... 阅读全文
posted @ 2018-02-05 17:43 zzYzz 阅读(176) 评论(0) 推荐(0) 编辑


Click to Visit Homepage : zzyzz.top


点击右上角即可分享
微信分享提示