摘要:
import requests from urllib.parse import urlencode from requests import codes import os from hashlib import md5 from multiprocessing.pool import Pool 阅读全文
摘要:
哈希表 hashtable hashfunc构造方法: 取余法, 平方留中法,平方后留中间的数再取余 非数项(字符串散列)# 转换为ascii码,分组,转换,相加求和再取余,记得因为字符串的特性,hashfunc还要加权重因子,不然‘cat’ ‘atc’会哈希碰撞 哈希碰撞解决方法: 开放定址 (线 阅读全文
摘要:
# 汉诺塔 hanoi # 大象放进冰箱里分机构步骤? # n = 1 (a -> c) 2^1 - 1 # n = 2 (a -> b) (a -> c) (b -> c) 2^2 - 1 # | - move 1 from a to c # | - move 2 from a to b | - 阅读全文
摘要:
from turtle import * from random import * from math import * def tree(n,l): pd()#下笔 #阴影效果 t = cos(radians(heading()+45))/8+0.25 pencolor(t,t,t) pensiz 阅读全文
摘要:
# 递归的三个条件 # 基本结束条件 # 向基本结束条件演进 # 调用自身 # 理解递归# 递归就是把大问题一步步不断的化解为小问题,小问题解决后在一步步依赖回去解决大问题。# (1+3+5+7+9) # -> (1+(3+5+7+9)) # ->(1+(3+(5+7+9)))# ->(1+(3+( 阅读全文
摘要:
1. python内置list实现 我们知道list 是由数组实现的 insert O(n) append O(1) class Deque(): def __init__(self): self.items = [] def isEmpty(self): return self.items == 阅读全文
摘要:
1.list实现 enqueue append() dequeue pop(0) 或 enqueue insert(0,item) dequeue pop() MAX_SIZE = 100 class MyQueue1(object): """模拟队列""" def __init__(self): 阅读全文
摘要:
1.设置首尾指针实现链队 # 首尾指针实现 # 链队 首尾指针实现链队 class Node(): def __init__(self, value=None): self.value = value self.next = None class StcakQueue(): def __init__ 阅读全文
摘要:
# 找数组最小值 arry_list = [23,65,89,778,236,665,9,995,152,66,5,668,123,3,566,89] def findMinAndMax_1(List): max = List[0] min = List[0] length = len(List) 阅读全文
摘要:
# 回文词与双端队列 class Deque(): def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def addFront(self, item): self.items.append(i 阅读全文