This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: RESEARCH CONTRIBUTIONS Programming Techniques and Data Structures MinMax Heaps and Ian Munro Editor Generalized Priority Queues M. D. ATKINSON, J.R. SACK, N. SANTORO, and T. STROTHOTTE ABSTRACT: ,4 simple implementation of double ended priority queues is presented. The proposed structure, called a minmax heap, can be built in linear time; in contrast to conventional heaps, it allows both FindMin and FindMax to be performed in constant time; Insert, DeleteMin, and DeleteMax operations can be performed in logarithmic time. Minmax heaps can be generalized to support other similar orderstatistics operations efficiently (e.g., constant time FindMedian and logarithmic time DeleteMedian); furthermore, the notion of minmax ordering can be extended to other heapordered structures, such as leftist trees. 1. INTRODUCTION A (singleended) priority queue is a data type sup porting the following operations on an ordered set of values: 1) find the maximum value (FindMax); 2) delete the maximum value (DeleteMax); 3) add a new value x (Insert(x)). Obviously, the priority queue can be redefined by substituting operations 1) and 2) with FindMin and DeleteMin, respectively. Several structures, some implicitly stored in an array and some using more complex data structures, have been presented for implementing this data type, including maxheaps (or minheaps) [8, 121. This research was supported in part by the National Science and Engineering Council of Canada under Grants A2419. A2415. and A0332. 01986 ACMOOOl0782/86/10000996 75a: 996 Communications of the ACM Conceptually, a maxheap is a binary tree having the following properties: a) heapshape: all leaves lie on at most two adja cent levels, and the leaves on the last level occupy the leftmost positions; all other levels are complete. b) maxordering: the value stored at a node is greater than or equal to the values stored at its chil dren. A maxheap of size n can be constructed in linear time and can be stored in an nelement array; hence it is referred to as an implicit data structure [g]. When a maxheap implements a priority queue, FindMax can be performed in constant time, while both DeleteMax and Insert(x) have logarithmic time. We shall consider a more powerful data type, the doubleended priority queue, which allows both FindMin and FindMax, as well as DeleteMin, DeleteMax, and Insert(x) operations. An important application of this data type is in external quicksort [5, p, 1621. A traditional heap does not allow efficient imple mentation of all the above operations; for example, FindMin requires linear (instead of constant) time in a maxheap. One approach to overcoming this in trinsic limitation of heaps, is to place a maxheap “backtoback” with a minheap as suggested by Wil liams [8, p. 6191. This leads to constant time Find either extremum and logarithmic time to Insert an element or Delete one of the extrema, but is some what trickier to implement than the method follow ing....
View
Full
Document
 Winter '07
 Mullins
 Data Structures, Binary heap, Array data structure, Priority queue, Selection algorithm, minmax heap

Click to edit the document details