You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've used the PriorityQueue a bit and noticed something that looks like a bug to me. It seems like if the same element is inserted again after have being extracted once alrady, is not possible.
See this minimal example:
constPriorityQueue=require("algorithms/data_structures").PriorityQueue;constq=newPriorityQueue();// Inserting and extracting one time works as expected:q.insert("a",1);console.log(q.isEmpty());console.log(q.extract());console.log(q.isEmpty());// Inserting 'a' again does not work, queue will be empty and nothing to extract:q.insert("a",1);console.log(q.isEmpty());console.log(q.extract());
The outoupt of this is:
false
a
true
true
undefined
while the expected output is:
false
a
true
false
a
My system:
node v19.2.0.
macOS 13.0.1
The text was updated successfully, but these errors were encountered:
Thanks for providing this module.
I've used the PriorityQueue a bit and noticed something that looks like a bug to me. It seems like if the same element is inserted again after have being extracted once alrady, is not possible.
See this minimal example:
The outoupt of this is:
while the expected output is:
My system:
v19.2.0
.13.0.1
The text was updated successfully, but these errors were encountered: