@Override
 public Position<E> right(Position<E> v)
     throws InvalidPositionException, BoundaryViolationException {
   if (!hasRight(v)) {
     throw new BoundaryViolationException("No right child");
   }
   BTPos<E> pos = checkPosition(v);
   return T.get(2 * pos.index() + 1);
 }
 @Override
 public Position<E> parent(Position<E> v)
     throws InvalidPositionException, BoundaryViolationException {
   if (isRoot(v)) {
     throw new BoundaryViolationException("No parent for root.");
   }
   BTPos<E> pos = checkPosition(v);
   return T.get(pos.index() / 2);
 }
 @Override
 public boolean isRoot(Position<E> v) throws InvalidPositionException {
   BTPos<E> pos = checkPosition(v);
   return pos.index() == 1;
 }
 @Override
 public E replace(Position<E> v, E e) throws InvalidPositionException {
   BTPos<E> pos = checkPosition(v);
   return pos.setElement(e);
 }
 @Override
 public boolean hasRight(Position<E> v) throws InvalidPositionException {
   BTPos<E> pos = checkPosition(v);
   return 2 * pos.index() + 1 <= size();
 }