Skip to main content

CloberOctopusHeap

CloberOctopusHeap

Heap data structure that can hold up to 256 uint16 values. Each value is stored by having the quotient divided by 2^8 added to the heap, and the remainder expressed as a flag on a bitmap.

init

function init() external

Initializes the heap.

Must be called before use.

has

function has(uint16 value) external view returns (bool)

Checks if the specified value is present in the heap.

Parameters

NameTypeDescription
valueuint16The value to check for.

Return Values

NameTypeDescription
[0]boolTrue if the value is present in the heap, false otherwise.

isEmpty

function isEmpty() external view returns (bool)

Checks if the heap is empty.

Return Values

NameTypeDescription
[0]boolTrue if the heap is empty, false otherwise.

push

function push(uint16 value) external

Pushes a value onto the heap.

Parameters

NameTypeDescription
valueuint16The value to push onto the heap.

pop

function pop() external

Pops a value from the heap.

root

function root() external view returns (uint16)

Returns the root value of the heap.

Return Values

NameTypeDescription
[0]uint16The root value of the heap.