Table of Contents

Class BinaryHeap

Namespace
Sportradar.LiveData.Sdk.Services.PriorityQueue
Assembly
Sportradar.LiveData.Sdk.dll

Collection implemented with the properties of a binary heap.

public class BinaryHeap : ICollection, IEnumerable, ICloneable
Inheritance
BinaryHeap
Implements
Derived
Inherited Members

Constructors

BinaryHeap()

Initialize the heap.

public BinaryHeap()

BinaryHeap(BinaryHeap)

Initialize the heap with another heap.

public BinaryHeap(BinaryHeap heap)

Parameters

heap BinaryHeap

The heap on which to perform a shallow-copy.

BinaryHeap(IComparer)

Initialize the heap.

public BinaryHeap(IComparer comparer)

Parameters

comparer IComparer

BinaryHeap(IComparer, int)

Initialize the heap.

public BinaryHeap(IComparer comparer, int capacity)

Parameters

comparer IComparer
capacity int

BinaryHeap(int)

Initialize the heap.

public BinaryHeap(int capacity)

Parameters

capacity int

The initial size of the heap.

Properties

Count

Gets the number of objects stored in the heap.

public virtual int Count { get; }

Property Value

int

IsSynchronized

Gets a value indicating whether this heap is synchronized.

public virtual bool IsSynchronized { get; }

Property Value

bool

SyncRoot

Gets an object which can be locked in order to synchronize this class.

public object SyncRoot { get; }

Property Value

object

Methods

BottomElement()

Checks the entry at the bottom of the heap.

public virtual object BottomElement()

Returns

object

The entry.

Clear()

Empties the heap.

public virtual void Clear()

Clone()

Performs a shallow-copy of the heap.

public virtual BinaryHeap Clone()

Returns

BinaryHeap

A shallow-copy of the heap.

Contains(object)

Determines whether an object is in the heap.

public virtual bool Contains(object value)

Parameters

value object

The object for which we want to search.

Returns

bool

Whether the object is in the heap.

CopyTo(Array, int)

Copies the entire heap to a compatible one-dimensional array, starting at the given index.

public virtual void CopyTo(Array array, int index)

Parameters

array Array

The array to which the heap should be copied.

index int

The starting index.

GetEnumerator()

Gets an enumerator for the heap.

public virtual IEnumerator GetEnumerator()

Returns

IEnumerator

An enumerator for all elements of the heap.

Insert(object, object)

Adds an item to the heap.

public virtual void Insert(object key, object value)

Parameters

key object

The key for this entry.

value object

The value for this entry.

Remove()

Removes the entry at the top of the heap.

public virtual object Remove()

Returns

object

The removed entry.

RemoveLast()

Remove the worst element.

public object RemoveLast()

Returns

object

Synchronize(BinaryHeap)

Ensures that heap is wrapped in a synchronous wrapper.

public static BinaryHeap Synchronize(BinaryHeap heap)

Parameters

heap BinaryHeap

The heap to be wrapped.

Returns

BinaryHeap

A synchronized wrapper for the heap.

TopElement()

Checks the entry at the top of the heap.

public virtual object TopElement()

Returns

object

The entry.