左神算法学习总结

 

总结中.......

 

左神直通BAT算法笔记(基础篇) (有这一篇就够了

https://www.nowcoder.com/discuss/150060?type=0&order=0&pos=6&page=1

 

算法初级02——荷兰国旗问题、随机快速排序、堆排序、桶排序、相邻两数的最大差值问题、工程中的综合排序算法

http://www.likecs.com/show-39882.html

算法初级面试题07——前缀树应用、介绍和证明贪心策略、拼接字符串得到最低字典序、切金条问题、项目收益最大化问题、随时取中位数、宣讲会安排

http://www.likecs.com/show-50511.html

 

reference:

堆排序

https://www.cnblogs.com/sxkgeek/p/9662491.html

左神算法讲堂笔记 09 由递归到动态规划

http://www.pianshen.com/article/5111260690/

#汉诺塔 python实现
import sys

def Move(src,des,n):
   print("move src[%s] to des[%s]  --n[%d]" %(src,des,n))

def hannuota(src, des, via, n):
    if (n ==1):
       Move(src,des,1)
    else:
       hannuota(src, via, des, n-1)
       Move(src, des, n)
       hannuota(via, des, src, n-1)

if __name__ == '__main__':
    sys.setrecursionlimit(10000)
    hannuota("左", "中", "右", 4)


>>> ================================ RESTART ================================
>>> 
move src[左] to des[右]  --n[1]
move src[左] to des[中]  --n[2]
move src[右] to des[中]  --n[1]
move src[左] to des[右]  --n[3]
move src[中] to des[左]  --n[1]
move src[中] to des[右]  --n[2]
move src[左] to des[右]  --n[1]
move src[左] to des[中]  --n[4]
move src[右] to des[中]  --n[1]
move src[右] to des[左]  --n[2]
move src[中] to des[左]  --n[1]
move src[右] to des[中]  --n[3]
move src[左] to des[右]  --n[1]
move src[左] to des[中]  --n[2]
move src[右] to des[中]  --n[1]
>>> 

 

你可能感兴趣的:(算法)