Skip to content

Commit 9e55c9d

Browse files
Jiayoqincclauss
andauthored
Added documentations (TheAlgorithms#11352)
* Added documentations * Update data_structures/queue/circular_queue.py --------- Co-authored-by: Christian Clauss <[email protected]>
1 parent cc2f5b1 commit 9e55c9d

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

data_structures/queue/circular_queue.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def __len__(self) -> int:
2525

2626
def is_empty(self) -> bool:
2727
"""
28+
Checks whether the queue is empty or not
2829
>>> cq = CircularQueue(5)
2930
>>> cq.is_empty()
3031
True
@@ -35,6 +36,7 @@ def is_empty(self) -> bool:
3536

3637
def first(self):
3738
"""
39+
Returns the first element of the queue
3840
>>> cq = CircularQueue(5)
3941
>>> cq.first()
4042
False
@@ -45,7 +47,8 @@ def first(self):
4547

4648
def enqueue(self, data):
4749
"""
48-
This function insert an element in the queue using self.rear value as an index
50+
This function inserts an element at the end of the queue using self.rear value
51+
as an index.
4952
>>> cq = CircularQueue(5)
5053
>>> cq.enqueue("A") # doctest: +ELLIPSIS
5154
<data_structures.queue.circular_queue.CircularQueue object at ...
@@ -67,7 +70,7 @@ def enqueue(self, data):
6770
def dequeue(self):
6871
"""
6972
This function removes an element from the queue using on self.front value as an
70-
index
73+
index and returns it
7174
>>> cq = CircularQueue(5)
7275
>>> cq.dequeue()
7376
Traceback (most recent call last):

data_structures/queue/circular_queue_linked_list.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def create_linked_list(self, initial_capacity: int) -> None:
3939

4040
def is_empty(self) -> bool:
4141
"""
42-
Checks where the queue is empty or not
42+
Checks whether the queue is empty or not
4343
>>> cq = CircularQueueLinkedList()
4444
>>> cq.is_empty()
4545
True

0 commit comments

Comments
 (0)