-
-
Notifications
You must be signed in to change notification settings - Fork 411
feat: Add circular queue data structure implementation #70
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
feat: Add circular queue data structure implementation #70
Conversation
Data-Structures/Queue.ts
Outdated
* @function .length - returns the size of the qeuue | ||
* @function .isEmpty - returns if the queue is empty | ||
*/ | ||
/* queue data-structure. It's work is based on the LIFO method (last-IN-first-OUT). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please clean up your comments here
- Making suggested changes
I choosed to use a circular array implementation of the queue, is this ok? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not an addition but rather a modification, which should ideally be its own class CircularQueue
? It might implement the same Queue
interface as the basic Queue
.
I made the suggested changes, I think that an queue interface it makes more sense when other implementation of queue is added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should extend the queue, not replace it by a circular queue.
@@ -2,7 +2,13 @@ | |||
* @class CircularQueue | |||
* @description Circular implementation of a queue | |||
*/ | |||
export class CircularQueue<T> { | |||
export interface Queue<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. That way you still get rid of the non-circular Queue implementation. I want there to be two Queue classes, one circular and the other one not circular. They may both implement a common interface.
@appgurueu This PR can be closed. Implemented in #116 |
Addition of a queue data structure class