trees.py
def depth(self, tree: Tree) -> Optional[int]:
        """ Return the depth of the subtree <tree> relative to <self>. Return
        None if <tree> is not a descendant of <self> and if <tree> is <self>.

        Runtime: O(log(n))
        >>> tree = QuadTree((100, 100))
        >>> tree.insert('a', (90, 90))
        >>> tree.insert('b', (150, 150))
        >>> tree1 = tree.__getattribute__('_nw')
        >>> tree.depth(tree1)
        1
        """
        if isinstance(tree, QuadTree):
            if tree is self or self.is_leaf() or tree.is_empty():
                return None
            x, y = self._centre
            x1, y1 = tree._centre
            if x1 > 2 * x or y1 > 2 * y or x1 < 0 or y1 < 0:
                return None
            subtree = self._point_position(tree._centre)[0]
            if subtree:
                dep = subtree._help_depth(tree)
                if dep is not None:
                    return 1 + dep
 Return the depth of the subtree <tree> relative to <self>. Return
        None if <tree> is not a descendant of <self> and if <tree> is <self>.

        Runtime: O(log(n))
        >>> tree = QuadTree((100, 100))
        >>> tree.insert('a', (90, 90))
        >>> tree.insert('b', (150, 150))
        >>> tree1 = tree.__getattribute__('_nw')
        >>> tree.depth(tree1)
        1
        
Return the depth of the subtree  relative to . Return
None if  is not a descendant of  and if  is .


Return the depth of the subtree relative to . Return None if is not a descendant of and if is .
def depth(self, tree: Tree) -> Optional[int]:
        if isinstance(tree, QuadTree):
            if tree is self or self.is_leaf() or tree.is_empty():
                return None
            x, y = self._centre
            x1, y1 = tree._centre
            if x1 > 2 * x or y1 > 2 * y or x1 < 0 or y1 < 0:
                return None
            subtree = self._point_position(tree._centre)[0]
            if subtree:
                dep = subtree._help_depth(tree)
                if dep is not None:
                    return 1 + dep
def depth ( self , tree : Tree ) -> Optional [ int ] : if isinstance ( tree , QuadTree ) : if tree is self or self . is_leaf ( ) or tree . is_empty ( ) : return None x , y = self . _centre x1 , y1 = tree . _centre if x1 > 2 * x or y1 > 2 * y or x1 < 0 or y1 < 0 : return None subtree = self . _point_position ( tree . _centre ) [ 0 ] if subtree : dep = subtree . _help_depth ( tree ) if dep is not None : return 1 + dep
Return the depth of the subtree <tree> relative to <self>.
Return the depth of the subtree <tree > relative to <self > .
""" Return the depth of the subtree <tree> relative to <self>. Return
        None if <tree> is not a descendant of <self> and if <tree> is <self>.

        Runtime: O(log(n))
        >>> tree = QuadTree((100, 100))
        >>> tree.insert('a', (90, 90))
        >>> tree.insert('b', (150, 150))
        >>> tree1 = tree.__getattribute__('_nw')
        >>> tree.depth(tree1)
        1
        """
self
tree
Tree