mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
Added documentations (#11352)
* Added documentations * Update data_structures/queue/circular_queue.py --------- Co-authored-by: Christian Clauss <cclauss@me.com>
This commit is contained in:
parent
cc2f5b1308
commit
9e55c9d984
|
@ -25,6 +25,7 @@ class CircularQueue:
|
|||
|
||||
def is_empty(self) -> bool:
|
||||
"""
|
||||
Checks whether the queue is empty or not
|
||||
>>> cq = CircularQueue(5)
|
||||
>>> cq.is_empty()
|
||||
True
|
||||
|
@ -35,6 +36,7 @@ class CircularQueue:
|
|||
|
||||
def first(self):
|
||||
"""
|
||||
Returns the first element of the queue
|
||||
>>> cq = CircularQueue(5)
|
||||
>>> cq.first()
|
||||
False
|
||||
|
@ -45,7 +47,8 @@ class CircularQueue:
|
|||
|
||||
def enqueue(self, data):
|
||||
"""
|
||||
This function insert an element in the queue using self.rear value as an index
|
||||
This function inserts an element at the end of the queue using self.rear value
|
||||
as an index.
|
||||
>>> cq = CircularQueue(5)
|
||||
>>> cq.enqueue("A") # doctest: +ELLIPSIS
|
||||
<data_structures.queue.circular_queue.CircularQueue object at ...
|
||||
|
@ -67,7 +70,7 @@ class CircularQueue:
|
|||
def dequeue(self):
|
||||
"""
|
||||
This function removes an element from the queue using on self.front value as an
|
||||
index
|
||||
index and returns it
|
||||
>>> cq = CircularQueue(5)
|
||||
>>> cq.dequeue()
|
||||
Traceback (most recent call last):
|
||||
|
|
|
@ -39,7 +39,7 @@ class CircularQueueLinkedList:
|
|||
|
||||
def is_empty(self) -> bool:
|
||||
"""
|
||||
Checks where the queue is empty or not
|
||||
Checks whether the queue is empty or not
|
||||
>>> cq = CircularQueueLinkedList()
|
||||
>>> cq.is_empty()
|
||||
True
|
||||
|
|
Loading…
Reference in New Issue
Block a user