Van Emde-Boas priority queue extraction


extract( var pq ) : integer; case pq is nil: Error; case pq is boolean array: Find last true entry; if only one entry remains then transform to SingleEntry; case pq is single element: return element; pq := nil; case pq is full node: return maximum; if bottom queue corresponding to maximum is single element then extract from top queue; max := max of bottom[ max of top ]; else extract from bottom; max := max of bottom; end;

Pascal source (514.extr.p)



© Addison-Wesley Publishing Co. Inc.