parameters: (root, target)
return_statement: return closest
docstring: Function to find the node closest to target iteratively
      Params:
          root -- the root node of the tree
          target -- the value to which closest node needs to be found.
docstring_summary: Function to find the node closest to target iteratively
      Params:
          root -- the root node of the tree
          target -- the value to which closest node needs to be found.
docstring_tokens: Function to find the node closest to target iteratively Params : root -- the root node of the tree target -- the value to which closest node needs to be found .
function: def closest_diff_iter(root, target):
      '''Function to find the node closest to target iteratively
      Params:
          root -- the root node of the tree
          target -- the value to which closest node needs to be found.
      '''
      if not root:
          return sys.maxsize
      closest = root.data
      while root:
          if abs(target - closest) >= abs(target - root.data):
              closest = root.data
          root = root.left if target < root.data else root.right
      return closest
function_tokens: def closest_diff_iter ( root , target ) : if not root : return sys . maxsize closest = root . data while root : if abs ( target - closest ) >= abs ( target - root . data ) : closest = root . data root = root . left if target < root . data else root . right return closest