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

Method is_empty

algorithms/data_structures/stack.py:33–39  ·  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

31 return "Top-> " + result
32
33 def is_empty(self) -> bool:
34 """Check if the stack is empty.
35
36 Returns:
37 True if the stack has no elements.
38 """
39 return self._top == -1
40
41 @abstractmethod
42 def __iter__(self) -> Iterator[object]:

Callers 4

popMethod · 0.45
peekMethod · 0.45
popMethod · 0.45
peekMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected