Enhanced C#
Loyc library documentation
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Public Member Functions | List of all members
Loyc.Collections.MinHeapInList< T > Class Template Reference

This priority queue wrapper type is returned from the AsMinHeap() extension method. More...


Source file:
Inheritance diagram for Loyc.Collections.MinHeapInList< T >:
Loyc.Collections.MinHeap< T, TList, TComparer > Loyc.Collections.MaxHeap< T, TList, TComparer > Loyc.Collections.IPriorityQueue< T > Loyc.Collections.IQueue< T > Loyc.Collections.IPush< in T > Loyc.Collections.ITryPop< out T > Loyc.Collections.ICount Loyc.Collections.IIsEmpty

Remarks

This priority queue wrapper type is returned from the AsMinHeap() extension method.

Public Member Functions

 MinHeapInList (IList< T >?list=null, IComparer< T >?comparer=null, Action< T, int >?onItemMoved=null)
 
- Public Member Functions inherited from Loyc.Collections.MinHeap< T, TList, TComparer >
 MinHeap (TList list, TComparer comparer, Action< T, int >?onItemMoved=null)
 
- Public Member Functions inherited from Loyc.Collections.MaxHeap< T, TList, TComparer >
 MaxHeap (TList list, TComparer comparer, Action< T, int >?onItemMoved=null)
 Initializes the heap wrapper with the list and comparer to use. Both parameters must not be null. More...
 
MaxHeap< T, TList, TComparer > Heapify ()
 Rearranges items to ensure that the underlying list has the heap property. Takes O(Count) time. More...
 
void Add (T item)
 Adds an item to the heap (synonym of Push()). Complexity: O(Count). More...
 
void Push (T item)
 Adds an item to the heap. Complexity: O(Count). More...
 
void PriorityChanged (int index)
 Notifies the heap that the priority of the item at the specified index has changed. The item is bubbled up or down as appropriate. More...
 
PopAndPush (T item)
 Combines a pop followed by a push into one operation that is more efficient than a separate Pop nad Push(T). More...
 
TryPop (out bool isEmpty)
 Removes the largest item from the heap (or smallest item, if this is a MinHeap). More...
 
Pop ()
 Removes the largest item from the heap (or smallest item, if this is a MinHeap). More...
 
TryPeek (out bool isEmpty)
 Gets the largest item from the heap if it is not empty (or the smallest item, if this is a MinHeap). More...
 
Peek ()
 Gets the largest item from the heap (or the smallest item, if this is a MinHeap). More...
 

Additional Inherited Members

- Properties inherited from Loyc.Collections.MaxHeap< T, TList, TComparer >
TList List [get]
 Returns the underlying list that represents the binary heap. More...
 
TComparer Comparer [get]
 
bool IsEmpty [get]
 
int Count [get]
 
- Properties inherited from Loyc.Collections.IIsEmpty
bool IsEmpty [get]
 
- Properties inherited from Loyc.Collections.ICount
int Count [get]
 Gets the number of items in the collection. More...
 
- Events inherited from Loyc.Collections.MaxHeap< T, TList, TComparer >
Action< T, int > OnItemMoved
 This optional callback is called whenever an item is placed into the heap, removed from the heap, or moved within the List that holds the contents of the heap. The callback is useful for certain algorithms, such as the Dijkstra algorithm, in which an object's priority may need to change while it is inside the heap. More...