-
Notifications
You must be signed in to change notification settings - Fork 272
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
Added Deque - Array #321
Added Deque - Array #321
Conversation
Codecov Report
@@ Coverage Diff @@
## master #321 +/- ##
=============================================
- Coverage 98.828% 98.557% -0.272%
=============================================
Files 25 25
Lines 3073 3119 +46
=============================================
+ Hits 3037 3074 +37
- Misses 36 45 +9
|
What's the difference between queue or doubly-ended queue other than the difference in end points for adding or removing elements? |
It can work like a stack and doubly linked list if used in a way but the queue's cannot |
I have implemented it only for array and yet to be in linked list.... |
In other words, can we make queue doubly ended? Do we need an extra class like, |
But as per people's knowledge the queue will always insert at end and remove at front but deque will have insert and delete at both sides, that's the reason they call it double ended queue. |
What about adding an extra argument, |
Yeah that can work too |
But I need to reframe the rear pointer to work for both double ended queue and regular queue if that's ok I will proceed doing changes with commit. |
You can try changes with queue. But do not delete ArrayDeque in your work branch for this PR in case we don't go with changes in queue. |
Cool I will complete it right away and show it you |
@czgdp1807 Now will this work!? |
else: | ||
obj.front = 0 | ||
obj.rear = items._num - 1 | ||
obj.deque = double_ended |
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.
Why different names? obj.double_ended
should have worked.
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.
Sure a thing
You can remove the Deque class. |
Yes |
@czgdp1807 Done |
Please make similar changes for |
Yeah sure @czgdp1807 I have a doubt in implementing the above in priority queue what should I name the operation as but in wikipedia it's given as https://en.wikipedia.org/wiki/Double-ended_priority_queue#Operations |
|
@czgdp1807 I did some improvements on suffix tree, it's working quite fine and shall I make the PR after this or now! |
Sure. |
pydatastructs/miscellaneous_data_structures/tests/test_queue.py
Outdated
Show resolved
Hide resolved
Yeah |
Array Deque
References to other Issues or PRs or Relevant literature
"Fixes #120". See #120
Brief description of what is fixed or changed
Added Array deque with DODA and created a abstract class for Deque
Other comments
Hope this code works fine and if there is any issue ping me, yes this PR also included the SWOC participation