Closed emin closed 6 years ago
It's because priority values are floats, which have a precision of 23 bits (about 7 digits). ~Try using GenericPriorityQueue
which supports a generic priority value (but is slightly slower than FastPriorityQueue
)~
I have an idea for the future on how to fix this, but I haven't found time to implement it yet.
[Edit] Oh, I just noticed you're using SimplePriorityQueue
, not FastPriorityQueue
. SimplePriorityQueue
already supports a generic priority type. Try declaring it SimplePriorityQueue<string, long>
instead.
Oh, I didn't know that. I was using SimplePriorityQueue and it doesn't say that limitation on Wiki page or any other place I looked for, maybe you should consider to add that to let people know beforehand. Thanks for the help.
It's mentioned in the XML documentation which should pop up when you use the class in Visual Studio
` SimplePriorityQueue priorityQueue = new SimplePriorityQueue();
`
I tried to change the numbers from example, and you dequeue them in order you queue them like normal queue, It's expected that you should dequeue them as 1, 2, 3.
I don't know it's related to the numbers being big (not support long etc). Or maybe I tried to use it wrong way. I should be able to use it with these numbers because they're timestamp values and I want to order the queue with them
Thanks