Replace double_ended_queue.py - #5429
Conversation
ghost
left a comment
There was a problem hiding this comment.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper reviewto trigger the checks for only added pull request files@algorithms-keeper review-allto trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
@poyea I do! I added the comparison on each doctest. Tell me if it's ok. |
|
Fixed issues with pre-commit. Hopefully that works. |
| values_list.append(aux.val) | ||
| aux = aux.next | ||
|
|
||
| return "[" + ", ".join(repr(val) for val in values_list) + "]" |
There was a problem hiding this comment.
https://docs.python.org/3/library/doctest.html
if __name__ == "__main__":
import doctest
doctest.testmod()|
@grbenjamin Please simply use this file to replace the existing
|
|
I guess we can do: list(built_in_deque) == list(our_deque)? |
Please provide an example of use of |
In def is_empty(self) -> bool:
"""
>>> ...
>>> list(built_in_deque) == list(our_deque)
"""
...? Or in all other doctests? @poyea |
@grbenjamin Yes, something like this, wherever we want to test the implementation : https://docs.python.org/3/library/collections.html?highlight=deque#collections.deque |
>>> from collections import deque
>>> d_collections = deque('123456')etc. |
poyea
left a comment
There was a problem hiding this comment.
Looks good. Thank you for your pull request!🤩
* Add deque_from_scratch.py * added deque_from_scratch.py * add extend, extendleft and make comparison * updated operations list * fix doctest on Deque.__iter__ * pre-commit fix * time complexity comments, change type hints * pre-commit fix * added more doctests

Replaced double_ended_queue.py with an implementation of it with nodes.
Checklist:
Fixes: #{$ISSUE_NO}.