 
Summary: Order 10:3136, 1993, 31
© 1993KtuwerAcademic Publishers. Printed in the Netherlands.
TransformingBinarySequencesUsingPriority
Queues
M. D. ATKINSON
Department of Mathematical and Computational Sciences, North Haugh, St. Andrews, Fife KY16
9SS, Scotland
Communicated by iV. Zaguia
(Received: 10 November 1992; accepted: 20 March 1993)
Abstract. A priority queue transforms an input sequence ~r into an output sequence r which is a
reordering of the sequence ~r. The set R of all such related pairs is studied in the case that tr is a
binary sequence. It is proved that R is a partial order and that IRI = c,~+1,the (n + 1)thCatalan
number, An efficient (O(n2)) algorithm is given for computing the number of outputs achievable
from a given input.
Mathematics Subject Classification(1991). 06A06.
Key words: Priority queue, binary sequence, enumeration.
1. Introduction
Abstract data types are a fundamental design tool in modern software systems.
Although there is an infinity of possible data types there is a small number only
of them which recur frequently in algorithm design (stacks, arrays, queues, dic
