tinyqueue icon indicating copy to clipboard operation
tinyqueue copied to clipboard

Is it a "stable queue" or not?

Open dko-slapdash opened this issue 5 years ago • 1 comments

Hi.

If I insert multiple items which are "equal" (i.e. for which the comparator returns 0), does pop() preserve the order in which the items were push()'ed? (Order preservation is called "stable property", i.e. there are "stable sorts", "stable queues" etc.)

Binary heap is typically not stable - https://cstheory.stackexchange.com/questions/593/is-there-a-stable-heap - so I assume tinyqueue is not stable as well?

It's not mentioned anywhere in the docs...

dko-slapdash avatar May 30 '20 03:05 dko-slapdash

Probably not stable, but I should definitely check and update the docs — good point!

mourner avatar May 30 '20 17:05 mourner