ilusm.dev

hp

Heap / Priority Queue.

Load with: use hp

Quick example

use hp

result = hpcm("value", 10)
prn(result)

Functions

Min heap

hpne()

Creates a new instance.

hpcm(h, fn)

Performs the operation. Takes h, fn.

hpne(ls)

Creates a new instance. Takes ls.

Operations

hphp(h, v)

Performs the operation. Takes h, v.

hppk(h)

Performs the operation. Takes h.

hppp(h)

Performs the operation. Takes h.

Internal

hpup(h, i)

Updates. Takes h, i.

hpdw(h, i)

Performs the operation. Takes h, i.

hpsw(h, a, b)

Performs the operation. Takes h, a, b.

hplt(h, a, b)

Performs the operation. Takes h, a, b.

Max heap

hpmxn()

Performs the operation.

Batch

hpfr(ls)

Creates from another format. Takes ls.

hpsrt(ls)

Performs the operation. Takes ls.

Query

hpsz(h)

Returns the size or count. Takes h.

hpem(h)

Performs the operation. Takes h.

hpcl(h)

Closes or clears. Takes h.

Peek min/max

hpmm(h)

Performs the operation. Takes h.

hpmm(h)

Performs the operation. Takes h.

Replace

hppl(h, v)

Performs the operation. Takes h, v.

Decrease key (for Dijkstra)

hpdc(h, i, v)

Performs the operation. Takes h, i, v.

Merge

hpmg(a, b)

Performs the operation. Takes a, b.

Limited size

hpne(sz)

Creates a new instance. Takes sz.

hphp(h, v)

Performs the operation. Takes h, v.

Notes

  • HTTP parser - request/response line parsing.