|
ADS
Algorithms and Data Structures
|
The PRIORITYQUEUE of section 10.1, with decreasing priority, in two concepts. More...
#include "ADS/priority/QueueCustomization.h"#include <concepts>#include <cstddef>#include <memory>#include <stdexcept>#include <type_traits>#include <utility>#include <vector>Go to the source code of this file.
Namespaces | |
| namespace | ADS |
Concepts | |
| concept | ADS::PriorityQueue |
| the PRIORITYQUEUE of section 10.1 without handles: the type of the items (Item or value_type), empty(), and queue_insert() of an item with the keys of the order of the queue (a Priority, one or two Keys, or none), queue_min() and queue_deleteMin(), the item of smallest priority read and removed | |
| concept | ADS::AddressablePriorityQueue |
| the PRIORITYQUEUE of section 10.1 with handles and decreasing priority: the types Item, Priority and Handle, and empty(), min(), deleteMin(), insert( x , p ), which gives the handle of \( x \), and decrease( y , p ) | |
The PRIORITYQUEUE of section 10.1, with decreasing priority, in two concepts.
PriorityQueue is the queue without handles: insert() of an item with the keys of its order, min() and deleteMin() the item of smallest priority, empty(); AddressablePriorityQueue adds the handles of the book, insert( x , p ) giving a handle of \( x \) and decrease( y , p ) lowering to \( p \) the priority of the item of the handle \( y \). Items of equal priority leave in no given order.
The base concept is read through the customization point objects queue_insert(), queue_min() and queue_deleteMin(), and the handles through queue_handle_t and queue_decrease(), which are in QueueCustomization.h [see QueueCustomization.h, which this header includes], so that a type that ADS does not own is a model of the concepts once it is adapted there.
HeapPriorityQueue realizes both concepts on a \( d \)-ary heap, ListPriorityQueue on a sorted or unsorted list, TreePriorityQueue on a Red-Black tree; FibonacciHeapPriorityQueue, PairingHeap and IndexedDaryHeap are realizations beyond the book. LinkedHeapPriorityQueue, a heap on a tree with pointers, has no handles and no decrease(), and is therefore a model of the base concept only, as are DaryHeap, BucketQueue, DialQueue, RadixHeap and std::priority_queue. How an algorithm lowers a priority on a queue of either kind is decrease_key_of() of Capabilities.h.