随笔分类 - 数据结构
摘要:哈希表 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
阅读全文

浙公网安备 33010602011771号