Doc(Tree): Add solution to doctest in balance
This commit is contained in:
parent
42dbfe9c86
commit
89d7baaed2
@ -702,6 +702,23 @@ class Tree(object):
|
|||||||
>>> t = Tree.from_str("1+2+3+4+5*6*7*8*9")
|
>>> t = Tree.from_str("1+2+3+4+5*6*7*8*9")
|
||||||
>>> bal_t = t.balance()
|
>>> bal_t = t.balance()
|
||||||
>>> print(bal_t)
|
>>> print(bal_t)
|
||||||
|
+
|
||||||
|
> +
|
||||||
|
| > +
|
||||||
|
| | > +
|
||||||
|
| | | > 1
|
||||||
|
| | | > 2
|
||||||
|
| | > 3
|
||||||
|
| > 4
|
||||||
|
> *
|
||||||
|
| > *
|
||||||
|
| | > *
|
||||||
|
| | | > 5
|
||||||
|
| | | > 6
|
||||||
|
| | > 7
|
||||||
|
| > *
|
||||||
|
| | > 8
|
||||||
|
| | > 9
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
l_depth = self.left_value.depth()
|
l_depth = self.left_value.depth()
|
||||||
|
Loading…
Reference in New Issue
Block a user