Jyrki-jubilee-20.01.2005

Jyrki-jubilee-20.01.2005 - Jubilee lecture, October...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Jubilee lecture, October 2004/January 2005 Title: Anatomy of a worst-case efficient priority queue Speaker: Jyrki Katajainen Co-workers: Amr Elmasry and Claus Jensen These slides are available at http://www.cphstl.dk/ . c circlecopyrt Performance Engineering Laboratory 1 Priority Queues Types E : elements manipulated C : compartments where elements are stored F : ordering used in element comparisons A : allocator used in memory management Assumptions The elements are only moved and com- pared, both operations having a cost of O (1). It is possible to get any information stored at a compartment at a cost of O (1). Both allocation and deallocation have a cost of O (1). c circlecopyrt Performance Engineering Laboratory 2 Priority-Queue Operations Let Q be a priority queue with type parame- ters (E , C , F , A) . E find-min(): Return a minimum element stored in Q . The minimum is taken with respect to F . C insert( E e ): Insert element e into Q and return its compartment for later use. void delete-min(): Remove a minimum ele- ment and its compartment from Q . void delete( C p ): Remove both the element stored at compartment p and p from Q . void decrease( C p , E e ): Replace the el- ement stored at compartment p with a smaller element e . void unite( priority queue (E , C , F , A) R ): Move all elements stored in R to Q . Some additional operations like a construc- tor, a destructor, empty(), and size() are nec- essary to make the data structure useful. c circlecopyrt Performance Engineering Laboratory 3 Warning When an element is inserted, the reference to the compartment, where it is stored, should remain the same so that possible later ref- erences made by delete and decrease opera- tions are valid. Our solution to this potential problem is simple: we do not move the elements after they have been inserted into the data struc- ture. In the C ++ standard this is called iterator validity . c circlecopyrt Performance Engineering Laboratory 4 Comparison of Priority Queues operation binary heap worst case Fibonacci heap amortized pruned binomial queue worst case find-min (1) (1) (1) insert (lg n ) (1) (1) delete-min (lg n ) (lg n ) (lg n ) delete (lg n ) (lg n ) (lg n ) decrease (lg n ) (1) (1) unite ( n ) (1) (lg n ) n denotes the number of elements in the data structure just prior to the operation. c circlecopyrt Performance Engineering Laboratory 5 C ++ Standard The following complexity requirements no other time or space bounds are given. find-min(): constant time insert(): at most lg n element comparisons delete-min(): at most 2lg n element com- parisons general constructor: at most 3 n element comparisons priority-queue sort: at most n lg n element comparisons....
View Full Document

Page1 / 28

Jyrki-jubilee-20.01.2005 - Jubilee lecture, October...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online