mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-01-18 08:17:01 +00:00
Fix sphinx/build_docs warnings for data_structures/binary_tree/mirror_binary_tree (#12470)
This commit is contained in:
parent
c36aaf0fbc
commit
ae28fa7fe3
|
@ -56,6 +56,8 @@ class Node:
|
||||||
def make_tree_seven() -> Node:
|
def make_tree_seven() -> Node:
|
||||||
r"""
|
r"""
|
||||||
Return a binary tree with 7 nodes that looks like this:
|
Return a binary tree with 7 nodes that looks like this:
|
||||||
|
::
|
||||||
|
|
||||||
1
|
1
|
||||||
/ \
|
/ \
|
||||||
2 3
|
2 3
|
||||||
|
@ -81,13 +83,15 @@ def make_tree_seven() -> Node:
|
||||||
def make_tree_nine() -> Node:
|
def make_tree_nine() -> Node:
|
||||||
r"""
|
r"""
|
||||||
Return a binary tree with 9 nodes that looks like this:
|
Return a binary tree with 9 nodes that looks like this:
|
||||||
1
|
::
|
||||||
/ \
|
|
||||||
2 3
|
1
|
||||||
/ \ \
|
/ \
|
||||||
4 5 6
|
2 3
|
||||||
/ \ \
|
/ \ \
|
||||||
7 8 9
|
4 5 6
|
||||||
|
/ \ \
|
||||||
|
7 8 9
|
||||||
|
|
||||||
>>> tree_nine = make_tree_nine()
|
>>> tree_nine = make_tree_nine()
|
||||||
>>> len(tree_nine)
|
>>> len(tree_nine)
|
||||||
|
@ -117,23 +121,25 @@ def main() -> None:
|
||||||
>>> tuple(tree.mirror())
|
>>> tuple(tree.mirror())
|
||||||
(6, 3, 1, 9, 5, 2, 8, 4, 7)
|
(6, 3, 1, 9, 5, 2, 8, 4, 7)
|
||||||
|
|
||||||
nine_tree:
|
nine_tree::
|
||||||
1
|
|
||||||
/ \
|
1
|
||||||
2 3
|
/ \
|
||||||
/ \ \
|
2 3
|
||||||
4 5 6
|
/ \ \
|
||||||
/ \ \
|
4 5 6
|
||||||
7 8 9
|
/ \ \
|
||||||
|
7 8 9
|
||||||
|
|
||||||
|
The mirrored tree looks like this::
|
||||||
|
|
||||||
The mirrored tree looks like this:
|
|
||||||
1
|
1
|
||||||
/ \
|
/ \
|
||||||
3 2
|
3 2
|
||||||
/ / \
|
/ / \
|
||||||
6 5 4
|
6 5 4
|
||||||
/ / \
|
/ / \
|
||||||
9 8 7
|
9 8 7
|
||||||
"""
|
"""
|
||||||
trees = {"zero": Node(0), "seven": make_tree_seven(), "nine": make_tree_nine()}
|
trees = {"zero": Node(0), "seven": make_tree_seven(), "nine": make_tree_nine()}
|
||||||
for name, tree in trees.items():
|
for name, tree in trees.items():
|
||||||
|
|
Loading…
Reference in New Issue
Block a user