data_structures.binary_tree.binary_tree_mirror ============================================== .. py:module:: data_structures.binary_tree.binary_tree_mirror .. autoapi-nested-parse:: Problem Description: Given a binary tree, return its mirror. Attributes ---------- .. autoapisummary:: data_structures.binary_tree.binary_tree_mirror.binary_tree Functions --------- .. autoapisummary:: data_structures.binary_tree.binary_tree_mirror.binary_tree_mirror data_structures.binary_tree.binary_tree_mirror.binary_tree_mirror_dict Module Contents --------------- .. py:function:: binary_tree_mirror(binary_tree: dict, root: int = 1) -> dict >>> binary_tree_mirror({ 1: [2,3], 2: [4,5], 3: [6,7], 7: [8,9]}, 1) {1: [3, 2], 2: [5, 4], 3: [7, 6], 7: [9, 8]} >>> binary_tree_mirror({ 1: [2,3], 2: [4,5], 3: [6,7], 4: [10,11]}, 1) {1: [3, 2], 2: [5, 4], 3: [7, 6], 4: [11, 10]} >>> binary_tree_mirror({ 1: [2,3], 2: [4,5], 3: [6,7], 4: [10,11]}, 5) Traceback (most recent call last): ... ValueError: root 5 is not present in the binary_tree >>> binary_tree_mirror({}, 5) Traceback (most recent call last): ... ValueError: binary tree cannot be empty .. py:function:: binary_tree_mirror_dict(binary_tree_mirror_dictionary: dict, root: int) .. py:data:: binary_tree