mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-22 09:12:08 +00:00
git mv data_structures/queue data_structures/queues (#12577)
Co-authored-by: Christian Clauss <cclauss@me.com>
This commit is contained in:
parent
338cbafe0d
commit
738253e800
|
@ -16,7 +16,7 @@ repos:
|
||||||
- id: auto-walrus
|
- id: auto-walrus
|
||||||
|
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.9.4
|
rev: v0.9.6
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
- id: ruff-format
|
- id: ruff-format
|
||||||
|
@ -47,7 +47,7 @@ repos:
|
||||||
- id: validate-pyproject
|
- id: validate-pyproject
|
||||||
|
|
||||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||||
rev: v1.14.1
|
rev: v1.15.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: mypy
|
- id: mypy
|
||||||
args:
|
args:
|
||||||
|
|
18
DIRECTORY.md
18
DIRECTORY.md
|
@ -275,15 +275,15 @@
|
||||||
* [Singly Linked List](data_structures/linked_list/singly_linked_list.py)
|
* [Singly Linked List](data_structures/linked_list/singly_linked_list.py)
|
||||||
* [Skip List](data_structures/linked_list/skip_list.py)
|
* [Skip List](data_structures/linked_list/skip_list.py)
|
||||||
* [Swap Nodes](data_structures/linked_list/swap_nodes.py)
|
* [Swap Nodes](data_structures/linked_list/swap_nodes.py)
|
||||||
* Queue
|
* Queues
|
||||||
* [Circular Queue](data_structures/queue/circular_queue.py)
|
* [Circular Queue](data_structures/queues/circular_queue.py)
|
||||||
* [Circular Queue Linked List](data_structures/queue/circular_queue_linked_list.py)
|
* [Circular Queue Linked List](data_structures/queues/circular_queue_linked_list.py)
|
||||||
* [Double Ended Queue](data_structures/queue/double_ended_queue.py)
|
* [Double Ended Queue](data_structures/queues/double_ended_queue.py)
|
||||||
* [Linked Queue](data_structures/queue/linked_queue.py)
|
* [Linked Queue](data_structures/queues/linked_queue.py)
|
||||||
* [Priority Queue Using List](data_structures/queue/priority_queue_using_list.py)
|
* [Priority Queue Using List](data_structures/queues/priority_queue_using_list.py)
|
||||||
* [Queue By List](data_structures/queue/queue_by_list.py)
|
* [Queue By List](data_structures/queues/queue_by_list.py)
|
||||||
* [Queue By Two Stacks](data_structures/queue/queue_by_two_stacks.py)
|
* [Queue By Two Stacks](data_structures/queues/queue_by_two_stacks.py)
|
||||||
* [Queue On Pseudo Stack](data_structures/queue/queue_on_pseudo_stack.py)
|
* [Queue On Pseudo Stack](data_structures/queues/queue_on_pseudo_stack.py)
|
||||||
* Stacks
|
* Stacks
|
||||||
* [Balanced Parentheses](data_structures/stacks/balanced_parentheses.py)
|
* [Balanced Parentheses](data_structures/stacks/balanced_parentheses.py)
|
||||||
* [Dijkstras Two Stack Algorithm](data_structures/stacks/dijkstras_two_stack_algorithm.py)
|
* [Dijkstras Two Stack Algorithm](data_structures/stacks/dijkstras_two_stack_algorithm.py)
|
||||||
|
|
|
@ -17,7 +17,9 @@ class CircularQueue:
|
||||||
>>> len(cq)
|
>>> len(cq)
|
||||||
0
|
0
|
||||||
>>> cq.enqueue("A") # doctest: +ELLIPSIS
|
>>> cq.enqueue("A") # doctest: +ELLIPSIS
|
||||||
<data_structures.queue.circular_queue.CircularQueue object at ...
|
<data_structures.queues.circular_queue.CircularQueue object at ...
|
||||||
|
>>> cq.array
|
||||||
|
['A', None, None, None, None]
|
||||||
>>> len(cq)
|
>>> len(cq)
|
||||||
1
|
1
|
||||||
"""
|
"""
|
||||||
|
@ -51,11 +53,13 @@ class CircularQueue:
|
||||||
as an index.
|
as an index.
|
||||||
>>> cq = CircularQueue(5)
|
>>> cq = CircularQueue(5)
|
||||||
>>> cq.enqueue("A") # doctest: +ELLIPSIS
|
>>> cq.enqueue("A") # doctest: +ELLIPSIS
|
||||||
<data_structures.queue.circular_queue.CircularQueue object at ...
|
<data_structures.queues.circular_queue.CircularQueue object at ...
|
||||||
>>> (cq.size, cq.first())
|
>>> (cq.size, cq.first())
|
||||||
(1, 'A')
|
(1, 'A')
|
||||||
>>> cq.enqueue("B") # doctest: +ELLIPSIS
|
>>> cq.enqueue("B") # doctest: +ELLIPSIS
|
||||||
<data_structures.queue.circular_queue.CircularQueue object at ...
|
<data_structures.queues.circular_queue.CircularQueue object at ...
|
||||||
|
>>> cq.array
|
||||||
|
['A', 'B', None, None, None]
|
||||||
>>> (cq.size, cq.first())
|
>>> (cq.size, cq.first())
|
||||||
(2, 'A')
|
(2, 'A')
|
||||||
"""
|
"""
|
|
@ -59,12 +59,12 @@ class FixedPriorityQueue:
|
||||||
>>> fpq.dequeue()
|
>>> fpq.dequeue()
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
...
|
...
|
||||||
data_structures.queue.priority_queue_using_list.UnderFlowError: All queues are empty
|
data_structures.queues.priority_queue_using_list.UnderFlowError: All queues are empty
|
||||||
>>> print(fpq)
|
>>> print(fpq)
|
||||||
Priority 0: []
|
Priority 0: []
|
||||||
Priority 1: []
|
Priority 1: []
|
||||||
Priority 2: []
|
Priority 2: []
|
||||||
"""
|
""" # noqa: E501
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.queues = [
|
self.queues = [
|
||||||
|
@ -141,7 +141,7 @@ class ElementPriorityQueue:
|
||||||
>>> epq.dequeue()
|
>>> epq.dequeue()
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
...
|
...
|
||||||
data_structures.queue.priority_queue_using_list.UnderFlowError: The queue is empty
|
data_structures.queues.priority_queue_using_list.UnderFlowError: The queue is empty
|
||||||
>>> print(epq)
|
>>> print(epq)
|
||||||
[]
|
[]
|
||||||
"""
|
"""
|
Loading…
Reference in New Issue
Block a user