Beispiel #1
0
def ktree_six_nodes():
    """ returns a ktree with a list of known values """
    ktree = KTree()
    ktree.insert(None, 1)
    ktree.insert(1, 2)
    ktree.insert(1, 3)
    ktree.insert(1, 4)
    ktree.insert(4, 5)
    ktree.insert(4, 6)
    return ktree
def small_ktree():
    """Return small k-ary tree."""
    tree = KTree()
    tree.insert(1, None)
    tree.insert(2, 1)
    tree.insert(3, 1)
    tree.insert(4, 1)
    tree.insert(5, 3)
    tree.insert(6, 3)
    tree.insert(7, 6)
    return tree
def empty_ktree():
    """Return empty k-ary tree."""
    return KTree()
def tree():
    """Instantiate tree."""
    a = KTree()
    a.insert(10)
    a.insert(5, 10)
    a.insert(3, 10)
    a.insert(6, 10)
    a.insert(15, 6)
    a.insert(11, 15)
    a.insert('meow', 10)
    return a
Beispiel #5
0
def ktree_empty():
    """ returns empty ktree """
    return KTree()