Implement the Stack family instance method flip declared as follows (this is a Stack<T>):
/** * Reverses ("flips") {@code this}. * * @updates this * @ensures this = rev(#this) */ public void flip();
Implement the Sequence family instance method flip declared as follows (this is a Sequence<T>):
/** * Reverses ("flips") {@code this}. * * @updates this * @ensures this = rev(#this) */ public void flip();
- Provide a second, different implementation of the instance method flip for Sequence<T>. If your first implementation is iterative (i.e., uses a loop), your second one should be recursive and vice versa.