priorityQueue does not poll out as expected
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- tooling
Research direction
Start by locating the PriorityQueue implementation and the test represented in the issue body. Reproduce the shown sequence of add and poll calls, then verify that polling returns 1, 2, 3, 4 in order and that the relevant test passes.
Written by the indexing model from the issue text.
Description
describe('priorityQueue Test:', () => {
it('should return correct priorityQueue results:', () => {
const pq = new PriorityQueue();
pq.add(1);
pq.add(2);
pq.add(3);
pq.add(4);
expect(pq.toString()).toBe('1,2,3,4');
expect(pq.poll()).toBe(1);
expect(pq.poll()).toBe(2);
expect(pq.poll()).toBe(3);
expect(pq.poll()).toBe(4);
});
});
now it poll out 1, 4, 3, 2 , expected: 1,2,3,4
- Dominant language
- JavaScript
- Stars
- 197k
- Forks
- 31k
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from trekhleb/javascript-algorithms
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
trekhleb/javascript-algorithms#2102 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
trekhleb/javascript-algorithms#2085 · 6 comments · 1 reaction ·
-
LinkedList methods. Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
trekhleb/javascript-algorithms#2065 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
trekhleb/javascript-algorithms#2057 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
trekhleb/javascript-algorithms#2056 ·
All issues in trekhleb/javascript-algorithms
Similar issues
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
status: needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100