MCPcopy Index your code
hub / github.com/keon/algorithms / enqueue

Method enqueue

algorithms/data_structures/queue.py:161–174  ·  view source on GitHub ↗

Add an item to the rear of the queue. Args: value: The value to enqueue.

(self, value: object)

Source from the content-addressed store, hash-verified

159 probe = probe.next
160
161 def enqueue(self, value: object) -> None:
162 """Add an item to the rear of the queue.
163
164 Args:
165 value: The value to enqueue.
166 """
167 node = QueueNode(value)
168 if self._front is None:
169 self._front = node
170 self._rear = node
171 else:
172 self._rear.next = node
173 self._rear = node
174 self._size += 1
175
176 def dequeue(self) -> object:
177 """Remove and return the front item.

Callers 1

Calls 1

QueueNodeClass · 0.85

Tested by 1