-
Provide an implementation for the following global procedure. (If s and t are
strings of items, s is permutation of t if and only if s contains exactly
the same items that t contains, but possibly in a different order.)
global_procedure Partition (
consumes Queue_Of_Integer& q,
preserves Integer p,
produces Queue_Of_Integer& q1,
produces Queue_Of_Integer& q2
);
/*!
ensures
q1 * q2 is permutation of #q and
for all x: integer where (x is in elements (q1))
(x <= p) and
for all x: integer where (x is in elements (q2))
(x > p)
!*/
-
Provide an implementation for the following global procedure.
global_procedure Combine (
produces Queue_Of_Integer& q,
consumes Integer p,
consumes Queue_Of_Integer& q1,
consumes Queue_Of_Integer& q2
);
/*!
ensures
q = #q1 * <#p> * #q2
!*/