Fibonacci heap. More...
Classes | |
class | Node |
Basic class the fibonacci heap is composed of. More... |
Public Member Functions | |
function | GetAuthor () |
function | GetName () |
function | GetShortName () |
function | GetDescription () |
function | GetVersion () |
function | GetDate () |
function | CreateInstance () |
function | GetCategory () |
constructor | Fibonacci_Heap () |
Create a new fibonacci heap. | |
function | Insert (item, priority) |
Insert a new entry in the heap. | |
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 | ExistsIn (list, item) |
Auxilary function to search through the whole heap. |
Public Attributes | |
_min = null | |
_min_index = 0 | |
_min_priority = 0 | |
_count = 0 | |
_root_list = null |
Fibonacci heap.
This heap is heavily optimized for the Insert and Pop functions. Peek and Pop always return the current lowest value in the list. Insert is implemented as a lazy insert, as it will simply add the new node to the root list. Sort is done on every Pop operation.
|
inline |
Create a new fibonacci heap.
function Fibonacci_Heap::Count | ( | ) |
Get the amount of current items in the list.
The complexity of this operation is O(1).
function Fibonacci_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 Fibonacci_Heap::ExistsIn | ( | list | , |
item | |||
) |
Auxilary function to search through the whole heap.
list | The list of nodes to look through. |
item | The item to search for. |
function Fibonacci_Heap::Insert | ( | item | , |
priority | |||
) |
Insert a new entry in the heap.
The complexity of this operation is O(1).
item | The item to add to the list. |
priority | The priority this item has. |
function Fibonacci_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 Fibonacci_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).