MCPcopy
hub / github.com/keon/algorithms / is_empty

Method is_empty

algorithms/stack/ordered_stack.py:34–40  ·  view source on GitHub ↗

Check if the stack is empty. Returns: True if the stack has no elements.

(self)

Source from the content-addressed store, hash-verified

32 self.items: list[int] = []
33
34 def is_empty(self) -> bool:
35 """Check if the stack is empty.
36
37 Returns:
38 True if the stack has no elements.
39 """
40 return self.items == []
41
42 def _push_direct(self, item: int) -> None:
43 """Append an item without enforcing order.

Callers 7

test_ordered_stackMethod · 0.95
pushMethod · 0.95
popMethod · 0.95
test_array_queueMethod · 0.45
test_array_stackMethod · 0.45

Calls

no outgoing calls

Tested by 5

test_ordered_stackMethod · 0.76
test_array_queueMethod · 0.36
test_array_stackMethod · 0.36