Two-tier relaxed heaps Presented by Claus Jensen Joint work with Amr Elmasry and Jyrki Katajainen Slides available at www.cphstl.dk.

Slides:



Advertisements
Similar presentations
Fibonacci Heaps Especially desirable when the number of calls to Extract-Min & Delete is small (note that all other operations run in O(1) This arises.
Advertisements

COL 106 Shweta Agrawal and Amit Kumar
Heaps1 Part-D2 Heaps Heaps2 Recall Priority Queue ADT (§ 7.1.3) A priority queue stores a collection of entries Each entry is a pair (key, value)
Priority Queues  MakeQueuecreate new empty queue  Insert(Q,k,p)insert key k with priority p  Delete(Q,k)delete key k (given a pointer)  DeleteMin(Q)delete.
Advanced Data structure
Rank-Pairing Heaps Robert Tarjan, Princeton University & HP Labs Joint work with Bernhard Haeupler and Siddhartha Sen, ESA
Number Systems and Data structures Amr Elmasry A. Elmasry, C. Jensen and J. Katajainen, The strictly-regular number system and worst-case.
F00 pq 1 Priority Queues Review the abstract data type Priority Queues Review different implementation options.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2009 Heap Lecture Chapter 6 Use NOTES feature to see explanation.
Priority Queues. Container of elements where each element has an associated key A key is an attribute that can identify rank or weight of an element Examples.
More sorting algorithms: Heap sort & Radix sort. Heap Data Structure and Heap Sort (Chapter 7.6)
Chapter 6: Priority Queues Priority Queues Binary Heaps Mark Allen Weiss: Data Structures and Algorithm Analysis in Java Lydia Sinapova, Simpson College.
Rank-Pairing Heaps Bernhard Haeupler, Siddhartha Sen, and Robert Tarjan, ESA
Nick Harvey & Kevin Zatloukal
CSE 373 Data Structures Lecture 12
Dijkstra/Prim 1 make-heap |V| insert |V| delete-min |E| decrease-key Priority Queues make-heap Operation insert find-min delete-min union decrease-key.
Source: Muangsin / Weiss1 Priority Queue (Heap) A kind of queue Dequeue gets element with the highest priority Priority is based on a comparable value.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2007 Heap Lecture Chapter 6 Use NOTES feature to see explanation.
5.9 Heaps of optimal complexity
Heaps and heapsort COMP171 Fall 2005 Part 2. Sorting III / Slide 2 Heap: array implementation Is it a good idea to store arbitrary.
B-Trees (continued) Analysis of worst-case and average number of disk accesses for an insert. Delete and analysis. Structure for B-tree node.
Binomial Heaps Jyh-Shing Roger Jang ( 張智星 ) CSIE Dept, National Taiwan University.
Princeton University COS 423 Theory of Algorithms Spring 2002 Kevin Wayne Fibonacci Heaps These lecture slides are adapted from CLRS, Chapter 20.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Lecture 11 Tuesday, 12/4/01 Advanced Data Structures Chapters.
Fundamental Structures of Computer Science March 02, 2006 Ananda Guna Binomial Heaps.
PRIORITY QUEUES (HEAPS). Queues are a standard mechanism for ordering tasks on a first-come, first-served basis However, some tasks may be more important.
Strict Fibonacci Heaps Gerth Stølting Brodal Aarhus University George Lagogiannis Robert Endre Tarjan Agricultural University of Athens Princeton University.
The Power of Incorrectness A Brief Introduction to Soft Heaps.
Brought to you by Max (ICQ: TEL: ) February 5, 2005 Advanced Data Structures Introduction.
The Binary Heap. Binary Heap Looks similar to a binary search tree BUT all the values stored in the subtree rooted at a node are greater than or equal.
Chapter 21 Binary Heap.
Chapter 11 Heap. Overview ● The heap is a special type of binary tree. ● It may be used either as a priority queue or as a tool for sorting.
Chapter 21 Priority Queue: Binary Heap Saurav Karmakar.
„Policy-Based Benchmarking of Weak Heaps and Their Relatives“ Asger Bruun*, Stefan Edelkamp, Jyrki Katajainen*, Jens Rasmussen* *University of Copenhagen.
An experimental study of priority queues By Claus Jensen University of Copenhagen.
B-Tree – Delete Delete 3. Delete 8. Delete
Change Keys in heaps Fibonacci heap Zhao Xiaobin.
1 Binomial Tree Binomial tree. n Recursive definition: B k-1 B0B0 BkBk B0B0 B1B1 B2B2 B3B3 B4B4.
Data Structure II So Pak Yeung Outline Review  Array  Sorted Array  Linked List Binary Search Tree Heap Hash Table.
Heaps and Heapsort Prof. Sin-Min Lee Department of Computer Science San Jose State University.
Binomial Tree B k-1 B0B0 BkBk B0B0 B1B1 B2B2 B3B3 B4B4 Adapted from: Kevin Wayne B k : a binomial tree B k-1 with the addition of a left child with another.
Data StructuresData Structures Priority Queue. Recall Queues FIFO:First-In, First-Out Some contexts where this seems right? Some contexts where some things.
1 Fat heaps (K & Tarjan 96). 2 Goal Want to achieve the performance of Fibonnaci heaps but on the worst case. Why ? Theoretical curiosity and some applications.
CMSC 341 Binomial Queues and Fibonacci Heaps. Basic Heap Operations OpBinary Heap Leftist Heap Binomial Queue Fibonacci Heap insertO(lgN) deleteMinO(lgN)
Advanced Data Structure By Kayman 21 Jan Outline Review of some data structures Array Linked List Sorted Array New stuff 3 of the most important.
CS 367 Introduction to Data Structures Lecture 8.
Priority Queues CS 110: Data Structures and Algorithms First Semester,
1 Chapter 6 Heapsort. 2 About this lecture Introduce Heap – Shape Property and Heap Property – Heap Operations Heapsort: Use Heap to Sort Fixing heap.
1 Fibonacci heaps: idea List of multiway trees which are all heap-ordered. Definition: A tree is called heap-ordered if the key of each node is greater.
Priority Queues CS /02/05 L7: PQs Slide 2 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved.
Fibonacci Heap Fibonacci heapshave better asymptotic time bounds than binary heaps for the INSERT, UNION, and DECREASE-KEY operations, and they.
Fibonacci Heaps. Fibonacci Binary insert O(1) O(log(n)) find O(1) N/A union O(1) N/A minimum O(1) O(1) decrease key O(1) O(log(n)) delete O(log(n) O(log(n))
Analysis of Algorithms
Data Structures Binomial Heaps Fibonacci Heaps Haim Kaplan & Uri Zwick
Experimental evaluation of Navigation piles
Data Structures & Algorithms
Heaps 8/2/2018 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser,
Source: Muangsin / Weiss
Bohyung Han CSE, POSTECH
Insert in amortized cost O(1), Merge in O(lgn) DeleteMax in O(lgn)
Binomial Heaps Chapter 19.
A simpler implementation and analysis of Chazelle’s
Ch. 8 Priority Queues And Heaps
ערמות בינומיות ופיבונצ'י
Strict Fibonacci Heaps
CS 583 Analysis of Algorithms
Heaps © 2014 Goodrich, Tamassia, Goldwasser Heaps Heaps
Topic 5: Heap data structure heap sort Priority queue
Heaps & Multi-way Search Trees
Priority Queues Binary Heaps
Presentation transcript:

Two-tier relaxed heaps Presented by Claus Jensen Joint work with Amr Elmasry and Jyrki Katajainen Slides available at

2 Heaps Our focus has been on the worst-case comparison complexity of the heap operations: –Find-min –Insert –Decrease(-key) –Delete The following heaps support decrease at O(1) cost in the worst case: –Run-relaxed heaps (Driscoll et al. 1988) –Fat heaps (Kaplan and Tarjan 1999)

3 Worst-case complexity bounds The number of element comparisons performed in the worst case Run-relaxed heaps Fat heaps Find-minO(1) InsertO(1) DecreaseO(1) Delete3lg n + O(1)2.6lg n + O(1)

4 Our two-tier relaxed heaps A two-tier relaxed heap has the following complexity bounds. Number of element comparisons Worst-case cost Find-minO(1) InsertO(1) DecreaseO(1) Deletelg n + 3lglg n + O(1)O(lg n)

5 Two-tier relaxed heaps A two-tier relaxed heap is composed of two run-relaxed heaps relying on a redundant zeroless representation Next: Number representations vs. data structures

6 A binomial heap using binary representation M = 111 two Digits = {0, 1} A binomial heap storing 7 integers which are kept in 3 binomial trees and stored in heap order within the trees The rank of a binomial tree is equal to the number of children of the root

7 A binomial heap using redundant binary representation M = 202 redundant two Digits = {0, 1, 2} A binomial heap storing 10 integers

8 A binomial heap using redundant zeroless representation M = 214 redundant four Digits = {1, 2, 3, 4} A binomial heap storing 14 integers

9 Zeroless number system Addition – M + 1 –Corresponds to inserting a node into the binomial heap Subtraction – M – 1 –Corresponds to extracting a node from the binomial heap

10 Insert and extract Using functionality which incrementally handles carries and borrows in the zeroless number system, both addition and subtraction can be accomplished at constant cost When using a carry/borrow stack to provide this functionality in the context of binomial heaps, both insert and extract can be performed at constant worst-case cost Next: Run-relaxed heaps

11 Run-relaxed heaps A run-relaxed heap is composed of relaxed binomial trees which are almost heap-ordered binomial trees Some nodes can be marked active indicating that there may be a heap-order violation The maximum number of active nodes is  lg n  (Driscoll et al. 1988) A singleton is an active node which has no active siblings A run is a sequence of consecutive active siblings

12 Run-relaxed heaps A series of run/singleton transformations is used to reduce the number of active nodes Illustrated with one of the singleton transformations

13 A run-relaxed heap A run-relaxed heap storing 10 integers. The relaxed binomial trees are drawn in schematic form and active nodes are drawn in grey

14 Two-tier relaxed heap components A two-tier relaxed heap has the following components: –An upper store which contains pointers to roots and active nodes held in the lower store –A lower store which contains the elements of the heap The two components are run-relaxed heaps using the redundant zeroless number system

15 A two-tier relaxed heap A two-tier relaxed heap storing 12 integers

16 Extra functionality at the upper store Lazy deletions: Sometimes nodes in the upper store are marked instead of being deleted –When the number of marked nodes reaches half of the total number of nodes, the marked nodes are removed by an incremental global rebuilding

17 Heap operations Find-min: –The upper-store find- min operation is called, and this operation returns either one of the roots or one of the active nodes

18 Heap operations Insert: –The lower-store insert operation is called which adds a new node to the lower store –A pointer to that node is inserted into the upper store –If due to a join of two trees a node is no longer a root, the pointer in the upper store associated with that node is marked

19 Heap operations Decrease: –After the element replacement the node is made active –If the number of active nodes has become too large, a constant number of transformations (singleton or run) is performed –A pointer to the node is inserted into the upper store

20 Heap operations Delete: –Lower store: The node is removed. A node is extracted, and this node and the roots of the former subtrees are joined together into a new tree –If deletion involves an internal node, the new root of the subtree is made active –Upper store: A pointer to the new root is inserted. If there exists a pointer to the removed node, it is deleted.

21 New contribution The introduction of extract Improved constant factors for delete

22 Open problems Constant factors for the find-min, insert, and decrease operations should be improved Can the bound for delete be improved to log n + O(1)? (this can be obtained when decrease is not supported)

23 Related work Amr Elmasry, Claus Jensen, and Jyrki Katajainen. Relaxed weak queues: an alternative to run-relaxed heaps. CPH STL Report Amr Elmasry, Claus Jensen, and Jyrki Katajainen. On the power of structural violations in priority queues. CPH STL Report Both available at