Skip to content
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 documentations #11352

Merged
merged 2 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions data_structures/queue/circular_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __len__(self) -> int:

def is_empty(self) -> bool:
"""
Checks whether the queue is empty or not
>>> cq = CircularQueue(5)
>>> cq.is_empty()
True
Expand All @@ -35,6 +36,7 @@ def is_empty(self) -> bool:

def first(self):
"""
Returns the first element of the queue
>>> cq = CircularQueue(5)
>>> cq.first()
False
Expand All @@ -45,7 +47,8 @@ def first(self):

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 ...
Expand All @@ -67,7 +70,7 @@ def enqueue(self, data):
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):
Expand Down
2 changes: 1 addition & 1 deletion data_structures/queue/circular_queue_linked_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def create_linked_list(self, initial_capacity: int) -> None:

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
Expand Down