zoukankan      html  css  js  c++  java
  • 深度优先与广度优先

    # 广度优先
    # class A(object):
    # def test(self):
    # print('from A')
    # class B(A):
    # def test(self):
    # print('from B')
    # class C(A):
    # def test(self):
    # print('from C')
    # class D(B):
    # def test(self):
    # print('from D')
    # class E(C):
    # def test(self):
    # print('from E')
    # class F(D,E):
    # def test(self):
    # print('from F')
    # pass
    # f1=F()
    # f1.test()
    '''
    from F
    '''
    # class A(object):
    # def test(self):
    # print('from A')
    # class B(A):
    # def test(self):
    # print('from B')
    # class C(A):
    # def test(self):
    # print('from C')
    # class D(B):
    # def test(self):
    # print('from D')
    # class E(C):
    # def test(self):
    # print('from E')
    # class F(D,E):
    # # def test(self):
    # # print('from F')
    # pass
    # f1=F()
    # f1.test()
    '''
    from D
    '''
    # class A(object):
    # def test(self):
    # print('from A')
    # class B(A):
    # def test(self):
    # print('from B')
    # class C(A):
    # def test(self):
    # print('from C')
    # class D(B):
    # # def test(self):
    # # print('from D')
    # pass
    # class E(C):
    # def test(self):
    # print('from E')
    # class F(D,E):
    # # def test(self):
    # # print('from F')
    # pass
    # f1=F()
    # f1.test()
    '''
    from B
    '''
    # class A(object):
    # def test(self):
    # print('from A')
    # class B(A):
    # # def test(self):
    # # print('from B')
    # pass
    # class C(A):
    # def test(self):
    # print('from C')
    # class D(B):
    # # def test(self):
    # # print('from D')
    # pass
    # class E(C):
    # def test(self):
    # print('from E')
    # class F(D,E):
    # # def test(self):
    # # print('from F')
    # pass
    # f1=F()
    # f1.test()
    '''
    from E
    '''
    # class A(object):
    # def test(self):
    # print('from A')
    # class B(A):
    # # def test(self):
    # # print('from B')
    # pass
    # class C(A):
    # def test(self):
    # print('from C')
    # class D(B):
    # # def test(self):
    # # print('from D')
    # pass
    # class E(C):
    # # def test(self):
    # # print('from E')
    # pass
    # class F(D,E):
    # # def test(self):
    # # print('from F')
    # pass
    # f1=F()
    # f1.test()
    '''
    from C
    '''
    # class A(object):
    # def test(self):
    # print('from A')
    # class B(A):
    # # def test(self):
    # # print('from B')
    # pass
    # class C(A):
    # # def test(self):
    # # print('from C')
    # pass
    # class D(B):
    # # def test(self):
    # # print('from D')
    # pass
    # class E(C):
    # # def test(self):
    # # print('from E')
    # pass
    # class F(D,E):
    # # def test(self):
    # # print('from F')
    # pass
    # f1=F()
    # f1.test()
    '''
    from A
    '''
    # class A(object):
    # def test(self):
    # print('from A')
    # class B(A):
    # # def test(self):
    # # print('from B')
    # pass
    # class C(A):
    # # def test(self):
    # # print('from C')
    # pass
    # class D(B):
    # # def test(self):
    # # print('from D')
    # pass
    # class E(C):
    # # def test(self):
    # # print('from E')
    # pass
    # class F(D,E):
    # # def test(self):
    # # print('from F')
    # pass
    # f1=F()
    # print(F.mro())
    '''
    [<class '__main__.F'>, <class '__main__.D'>, <class '__main__.B'>, <class '__main__.E'>, <class '__main__.C'>, <class '__main__.A'>, <class 'object'>]
    '''
  • 相关阅读:
    window.open的小技巧分享
    2019实习笔试编程题刷题心得
    剑指offer——面试题32.1:分行从上到下打印二叉树
    剑指offer——面试题32:从上到下打印二叉树
    剑指offer——面试题30:包含min函数的栈
    剑指offer——面试题29:顺时针打印矩阵
    字节跳动2018校招测试开发方向(第二批)
    剑指offer——面试题27:二叉树的镜像
    剑指offer——二叉树
    剑指offer——面试题26:判断二叉树B是否为二叉树A的子结构
  • 原文地址:https://www.cnblogs.com/0B0S/p/12088318.html
Copyright © 2011-2022 走看看