Class DaryMaxHeap<T>
A D-ary max heap implementation.
Inheritance
DaryMaxHeap<T>
Assembly: Advanced.Algorithms.dll
Syntax
public class DaryMaxHeap<T> : IEnumerable<T>, IEnumerable where T : IComparable
Type Parameters
Constructors
DaryMaxHeap(Int32, IEnumerable<T>)
Time complexity: O(n) when initial is provided otherwise O(1).
Declaration
public DaryMaxHeap(int k, IEnumerable<T> initial = null)
Parameters
Type |
Name |
Description |
Int32 |
k |
The number of children per heap node.
|
IEnumerable<T> |
initial |
The initial items if any.
|
Fields
Count
Declaration
Field Value
Methods
Time complexity: O(log(n) base K).
Declaration
Returns
GetEnumerator()
Declaration
public IEnumerator<T> GetEnumerator()
Returns
Insert(T)
Time complexity: O(log(n) base K).
Declaration
public void Insert(T newItem)
Parameters
Type |
Name |
Description |
T |
newItem |
|
PeekMax()
Declaration
Returns
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Implements