-
Provide an implementation for the Split and for the
Merge global procedures
specified below.
global_procedure Split (
consumes Queue_Of_Integer& q,
produces Queue_Of_Integer& q1,
produces Queue_Of_Integer& q2
);
/*!
ensures
q1 * q2 is permutation of #q and
|q2| <= |q1| <= |q2| + 1
!*/
global_procedure Merge (
consumes Queue_Of_Integer& q1,
consumes Queue_Of_Integer& q2,
produces Queue_Of_Integer& q
);
/*!
requires
IS_ORDERED (q1) and IS_ORDERED (q2)
ensures
q is permutation of #q1 * #q2 and
IS_ORDERED (q)
!*/