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

Method push

algorithms/data_structures/stack.py:159–168  ·  view source on GitHub ↗

Push a value onto the stack. Args: value: The value to push.

(self, value: object)

Source from the content-addressed store, hash-verified

157 probe = probe.next
158
159 def push(self, value: object) -> None:
160 """Push a value onto the stack.
161
162 Args:
163 value: The value to push.
164 """
165 node = StackNode(value)
166 node.next = self.head
167 self.head = node
168 self._top += 1
169
170 def pop(self) -> object:
171 """Remove and return the top element.

Callers 1

Calls 1

StackNodeClass · 0.85

Tested by 1