# BinaryHeapFactory

> **BinaryHeapFactory** = <`A`>(`order`, `items?`) => [`BinaryHeap`](/reference/knotkit/heap/interfaces/binaryheap/)<`A`>

Defined in: [packages/heap/src/binary-heap.ts:145](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/heap/src/binary-heap.ts#L145)

Create a [BinaryHeap](/reference/knotkit/heap/interfaces/binaryheap/) from an order and an optional iterable of items, bulk-built in O(n) when the items are supplied.

## Type Parameters

### A

`A`

## Parameters

### order

[`Order`](/reference/knotkit/heap/type-aliases/order/)<`A`>

### items?

`Iterable`<`A`>

## Returns

[`BinaryHeap`](/reference/knotkit/heap/interfaces/binaryheap/)<`A`>
