Skip to content

Commit

Permalink
fix default compare function for MinPriorityQueue
Browse files Browse the repository at this point in the history
  • Loading branch information
eyas-ranjous committed Jan 8, 2024
1 parent 7970cfa commit b4d3157
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/minPriorityQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { Heap, MinHeap } = require('@datastructures-js/heap');
const getMinCompare = (getCompareValue) => (a, b) => {
const aVal = typeof getCompareValue === 'function' ? getCompareValue(a) : a;
const bVal = typeof getCompareValue === 'function' ? getCompareValue(b) : b;
return aVal < bVal ? -1 : 1;
return aVal <= bVal ? -1 : 1;
};

/**
Expand Down

0 comments on commit b4d3157

Please sign in to comment.