参考老师的博客: 金角:http://www.cnblogs.com/alex3714/articles/5161349.html 银角:http://www.cnblogs.com/wupeiqi/articles/4963027.html 一.冒泡算法实例: a = [32,5,22,41,7,31,12,102,74,37,9,25] 1.方法1: count = 0for i in range(len(a)): for j in range(len(a)-1): if a[j] > a…
Decorator Pattern(装饰器模式),定义:Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.(动态地给一个对象添加一些额外的职责.就增加功能来说,装饰模式相比生成子类更为灵活) 装饰器的通用视图: 上图四个角色解释一下: 1.Component…