Priority Queue Implementation. More...
#include <opencv2/flann/heap.h>
Classes | |
struct | CompareT |
Public Member Functions | |
Heap (int sz) | |
Constructor. More... | |
void | clear () |
Clears the heap. More... | |
bool | empty () |
Tests if the heap is empty. More... | |
void | insert (T value) |
Insert a new element in the heap. More... | |
bool | popMin (T &value) |
Returns the node of minimum value from the heap (top of the heap). More... | |
int | size () |
Returns: heap size. More... | |
Priority Queue Implementation.
The priority queue is implemented with a heap. A heap is a complete (full) binary tree in which each parent is less than both of its children, but the order of the children is unspecified.
|
inline |
Constructor.
Params: sz = heap size
|
inline |
Clears the heap.
|
inline |
Tests if the heap is empty.
Returns: true is heap empty, false otherwise
References cvflann::Heap< T >::size().
|
inline |
Insert a new element in the heap.
We select the next empty leaf node, and then keep moving any larger parents down until the right location is found to store this element.
Params: value = the new element to be inserted in the heap
Referenced by cvflann::KDTreeIndex< Distance >::getParameters(), cvflann::KMeansIndex< Distance >::getParameters(), and cvflann::HierarchicalClusteringIndex< Distance >::getParameters().
|
inline |
Returns the node of minimum value from the heap (top of the heap).
Params: value = out parameter used to return the min element Returns: false if heap empty
Referenced by cvflann::KMeansIndex< Distance >::findNeighbors(), cvflann::HierarchicalClusteringIndex< Distance >::findNeighbors(), and cvflann::KDTreeIndex< Distance >::getParameters().
|
inline |
Returns: heap size.
Referenced by cvflann::Heap< T >::empty().