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

Method enqueue

algorithms/data_structures/queue.py:83–93  ·  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

81 probe += 1
82
83 def enqueue(self, value: object) -> None:
84 """Add an item to the rear of the queue.
85
86 Args:
87 value: The value to enqueue.
88 """
89 if self._rear == len(self._array):
90 self._expand()
91 self._array[self._rear] = value
92 self._rear += 1
93 self._size += 1
94
95 def dequeue(self) -> object:
96 """Remove and return the front item.

Callers 1

test_array_queueMethod · 0.95

Calls 1

_expandMethod · 0.95

Tested by 1

test_array_queueMethod · 0.76