(self)
return root
Load tree from file

        :return:
Load tree from file
Load tree from file
def load_tree(self) -> Node:
        """
        Load tree from file

        :return:
        """
        node_stack = deque()
        queue_leaves = deque()
        root = Node()

        current_node = root
        is_end_of_tree = False
        while not is_end_of_tree:
            current_bit = self.get_bit()
            if current_bit == "0":
                current_node.left = Node()
                current_node.right = Node()
                node_stack.append(current_node.right)  # going to left node, right push on stack
                current_node = current_node.left
            else:
                queue_leaves.append(current_node)
                if node_stack:
                    current_node = node_stack.pop()
                else:
                    is_end_of_tree = True

        self._fill_tree(queue_leaves)

        return root
def load_tree ( self ) -> Node : node_stack = deque ( ) queue_leaves = deque ( ) root = Node ( ) current_node = root is_end_of_tree = False while not is_end_of_tree : current_bit = self . get_bit ( ) if current_bit == "0" : current_node . left = Node ( ) current_node . right = Node ( ) node_stack . append ( current_node . right ) # going to left node, right push on stack current_node = current_node . left else : queue_leaves . append ( current_node ) if node_stack : current_node = node_stack . pop ( ) else : is_end_of_tree = True self . _fill_tree ( queue_leaves ) return root