Skip to content
New issue

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

Update PriorityQueue.js #1073

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

PradeepG-07
Copy link

Changed the default priority of a item to value of the item if the priority is not provided manually in the add() method.
Now it resolves the issue #1070
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);
});
});
It polls out values as 1,2,3,4

Changed the default priority to value of the item in the add() method.
Copy link

@obafemitayor obafemitayor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@PradeepG-07
Copy link
Author

Hi @obafemitayor,
Good to hear from you please merge the request if everything looks fine.
Thank you.

@obafemitayor
Copy link

Hi @obafemitayor,
Good to hear from you please merge the request if everything looks fine.
Thank you.

@PradeepG-07 I am not sure I can though. I need to be a maintainer to do that

@PradeepG-07
Copy link
Author

Lol 😄 That's okay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants