Beispiel #1
0
def create_btree(array):
    head = create_btree_helper(array, 0, len(array) - 1)
    tree = BTree(head)
    tree.show()
            if n.l is not None:
                nodes.append(n.l)
            if n.r is not None:
                nodes.append(n.r)

            count = count - 1

        l = LL(head)
        ll.append(l)

    for l in ll:
        l.show()


if __name__ == "__main__":
    head = BTreeNode(10)
    head.l = BTreeNode(5)
    head.r = BTreeNode(7)
    head.l.l = BTreeNode(6)
    head.l.r = BTreeNode(20)
    head.r.l = BTreeNode(18)
    head.r.r = BTreeNode(30)
    head.r.r.r = BTreeNode(50)
    head.r.r.r.r = BTreeNode(60)
    head.r.r.r.l = BTreeNode(70)

    tree = BTree(head)
    tree.show()
    ll_from_btree(tree)