We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PriorityQueue doesn't seem to guarantee order:
PriorityQueue
import { PriorityQueue } from 'typescript-collections'; interface Obj { prio: number; id: string; } const q = new PriorityQueue((a: Obj, b: Obj) => a.prio - b.prio); q.enqueue({ prio: 0, id: 'first' }); q.enqueue({ prio: 10, id: 'prio' }); q.enqueue({ prio: 0, id: 'another 1' }); q.enqueue({ prio: 0, id: 'another 2' }); q.enqueue({ prio: 0, id: 'last' }); let o: Obj | undefined; while (o = q.dequeue()) { console.log(o.id); }
outputs:
prio last another 2 another 1 first
(in this example the order is perfectly reversed but this won't be the case if enqueue/dequeue are interleaved)
enqueue
dequeue
The text was updated successfully, but these errors were encountered:
@mmomtchev I implemented a new version of this lib with modern approach. Feel free to use it. See: https://github.com/baloian/typescript-ds-lib/tree/master
Sorry, something went wrong.
No branches or pull requests
PriorityQueue
doesn't seem to guarantee order:outputs:
(in this example the order is perfectly reversed but this won't be the case if
enqueue
/dequeue
are interleaved)The text was updated successfully, but these errors were encountered: