(self, target)
return None
search the entire tree looking for a value" in dfs order
search the entire tree looking for a value" in dfs order
search the entire tree looking for a value in dfs order
def search_dfs(self, target):
        """ search the entire tree looking for a value" in dfs order"""
        stack = [self.root]
        while stack:
            curr = stack.pop()
            if curr.val == target:
                return curr
            if curr.right is not None:
                stack.append(curr.right)
            if curr.left is not None:
                stack.append(curr.left)
        return None
def search_dfs ( self , target ) : stack = [ self . root ] while stack : curr = stack . pop ( ) if curr . val == target : return curr if curr . right is not None : stack . append ( curr . right ) if curr . left is not None : stack . append ( curr . left ) return None