dwv.math. BucketQueue

new BucketQueue(bits, cost_functor)

Circular Bucket Queue.

Returns input'd points in sorted order. All operations run in roughly O(1) time (for input with small cost values), but it has a strict requirement:

If the most recent point had a cost of c, any points added should have a cost c' in the range c <= c' <= c + (capacity - 1).

Parameters:
NameTypeDescription
bitsnumber

Number of bits.

cost_functorfunction

The cost functor.