Bounded priority queue: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
Line 12: | Line 12: | ||
# Therefore, at any moment, it is <math>n\le N_\text{max}</math>. | # Therefore, at any moment, it is <math>n\le N_\text{max}</math>. | ||
'''Constructor:''' Gets a [[comparison]] <math>c</math> and a natural number <math>N_\text{max}</math>, and initializes the queue so as to be empty with a maximum capacity of <math>N_\text{max}</math> items. | '''Constructor:''' Gets a [[comparison]] <math>c</math> and a natural number <math>N_\text{max}</math>, and initializes the queue so as to be empty with a maximum capacity of <math>N_\text{max}</math> items. | ||
== Method == | |||
== Method == | |||
== Method == | |||
== Method == | |||
== Method == | |||
== Known implementations == | |||
[[Heap as array]] | |||
== Remark == | |||
== Reference == |
Revision as of 20:40, 29 September 2014
General information
Representation invariant:
- This abstract data structure is generic and parameterized by a fixed key type [math]\displaystyle{ \mathcal{K} }[/math] and a fixed comparison [math]\displaystyle{ c }[/math] defined on [math]\displaystyle{ \mathcal{K} }[/math].
- An object with key type [math]\displaystyle{ \mathcal{K} }[/math] represents a finite, dynamically changing multiset, of elements of type [math]\displaystyle{ \mathcal{K} }[/math] (the multiset may be empty).
- An object has two additional attributes, which are natural numbers:
- Attribute [math]\displaystyle{ n }[/math] stores the current number of elements (in particular, [math]\displaystyle{ n }[/math] is dynamically changing).
- Attribute [math]\displaystyle{ N_\text{max}\in\mathrm{N} }[/math] is the maximum number of elements that can be stored in the queue ([math]\displaystyle{ N_\text{max} }[/math] is constant throughout the object's life time).
- Therefore, at any moment, it is [math]\displaystyle{ n\le N_\text{max} }[/math].
Constructor: Gets a comparison [math]\displaystyle{ c }[/math] and a natural number [math]\displaystyle{ N_\text{max} }[/math], and initializes the queue so as to be empty with a maximum capacity of [math]\displaystyle{ N_\text{max} }[/math] items.