Skip to content

Latest commit

 

History

History
23 lines (12 loc) · 750 Bytes

BinaryHeap.md

File metadata and controls

23 lines (12 loc) · 750 Bytes

BinaryHeap

This is an abstract class

Represents a tree in which the value of each node is greater (MaxHeap) or smaller (MinHeap) than the value of all its children.


Properties

int Count Gets the number of elements contained in the BinaryHeap.

bool IsEmpty Determines whether the BinaryHeap is empty.


Methods

void Push(T value) Inserts a new element into the BinaryHeap. Complexity: O(LogN)

T Pop() Removes the element at the root of the BinaryHeap and returns its value, maintaining the BinaryHeap properties. Complexity: O(LogN)

T Peek() Returns the value of the root of the BinaryHeap without removing it. Complexity: O(1)