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 queue.py #337

Merged
merged 4 commits into from
Dec 3, 2023
Merged

update queue.py #337

merged 4 commits into from
Dec 3, 2023

Conversation

MrWeast
Copy link
Contributor

@MrWeast MrWeast commented Dec 1, 2023

changed implementation to not use built in python lists. added English comments

Description

Previous implementation used built in python lists which seems counter to the point of implementing a queue data structure since python lists already support queue functionality. I also added English comments since there is an open issue about that (#183).

New Queue:

  • queue data structure built from scratch
  • enqueue: will add an element to the tail of the queue
  • dequeue: will remove the element at the head of the queue if the queue is not empty
  • show: will show the elements in the queue, with the first element being the head of the queue
  • length: will return the length of the queue

To test the implementation you can run the file since it includes test cases in the main function of the file

changed implementation to not use built in python lists. added english comments
removed import random and added a comment
fixed formatting
Copy link
Owner

@kelvins kelvins left a comment

Choose a reason for hiding this comment

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

Thanks @MrWeast

@kelvins kelvins merged commit a0c6d09 into kelvins:main Dec 3, 2023
2 checks passed
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.

2 participants