Binary Heap. More...
Public Member Functions | |
| function | GetAuthor () |
| function | GetName () |
| function | GetShortName () |
| function | GetDescription () |
| function | GetVersion () |
| function | GetDate () |
| function | CreateInstance () |
| function | GetCategory () |
| function | Insert (item, priority) |
| Insert a new entry in the list. | |
| function | Pop () |
| Pop the first entry of the list. | |
| function | Peek () |
| Peek the first entry of the list. | |
| function | Count () |
| Get the amount of current items in the list. | |
| function | Exists (item) |
| Check if an item exists in the list. | |
| function | _BubbleDown () |
Public Attributes | |
| _queue = null | |
| _count = 0 | |
Binary Heap.
Peek and Pop always return the current lowest value in the list. Sort is done on insertion and on deletion.
| function Binary_Heap::Count | ( | ) |
Get the amount of current items in the list.
The complexity of this operation is O(1).
| function Binary_Heap::Exists | ( | item | ) |
Check if an item exists in the list.
The complexity of this operation is O(n).
| item | The item to check for. |
| function Binary_Heap::Insert | ( | item | , |
| priority | |||
| ) |
Insert a new entry in the list.
The complexity of this operation is O(ln n).
| item | The item to add to the list. |
| priority | The priority this item has. |
| function Binary_Heap::Peek | ( | ) |
Peek the first entry of the list.
This is always the item with the lowest priority. The complexity of this operation is O(1).
| function Binary_Heap::Pop | ( | ) |
Pop the first entry of the list.
This is always the item with the lowest priority. The complexity of this operation is O(ln n).
1.8.1.2