public static <T, N extends ModifiableBinaryTreeNode<T, N>> N predecessor(N t)
  {
    if (t == null)
    {
      return null;
    }
    else if (t.getLeft() != null)
    {
      N p = t.getLeft();
      while (p.getRight() != null)
      {
        p = p.getRight();
      }
      return p;
    }
    else
    {
      N p = t.getParent();
      N ch = t;
      while (p != null && ch == p.getLeft())
      {
        ch = p;
        p = p.getParent();
      }
      return p;
    }
  }