Stack#
- class Stack#
Bases:
Container
,Generic
[T
]- __init__()#
Methods
__init__
()increment_n_ops
([increment])Convenience method to increment n_ops count of the given complexity object.
peek
()Returns the top element of the stack without removing it.
pop
()Remove element from the top of the stack.
push
(value)Add element to top of the stack.
Convenience method to reset n_ops count of the given complexity object.
Attributes
- rtype:
str
- rtype:
str
- rtype:
str
- rtype:
str
- rtype:
str
- rtype:
str
- rtype:
str
- rtype:
str
- rtype:
str
- rtype:
bool
- rtype:
int
- rtype:
str
- rtype:
int
- rtype:
str
- rtype:
str
- rtype:
str
- rtype:
str
- rtype:
str
- rtype:
str
- rtype:
str
- property average_case_delete_time_complexity: str#
- Return type:
str
- property average_case_insert_time_complexity: str#
- Return type:
str
- property average_case_search_time_complexity: str#
- Return type:
str
- property best_case_delete_description: str#
- Return type:
str
- property best_case_delete_time_complexity: str#
- Return type:
str
- property best_case_insert_description: str#
- Return type:
str
- property best_case_insert_time_complexity: str#
- Return type:
str
- property best_case_search_description: str#
- Return type:
str
- property best_case_search_time_complexity: str#
- Return type:
str
- increment_n_ops(increment=1)#
Convenience method to increment n_ops count of the given complexity object.
- Return type:
None
- property is_empty: bool#
- Return type:
bool
- property n_ops: int#
- Return type:
int
- property name: str#
- Return type:
str
- peek()#
Returns the top element of the stack without removing it.
- Returns:
head – Element from the beginning of the stack or None if the stack is empty.
- Return type:
Optional[Any]
- pop()#
Remove element from the top of the stack.
- Returns:
top – Element from the top of the stack.
- Return type:
Any
- push(value)#
Add element to top of the stack.
- Parameters:
value (Any) – Element to add to the stack
- Return type:
None
- reset_n_ops()#
Convenience method to reset n_ops count of the given complexity object.
- Return type:
None
- property size: int#
- Return type:
int
- property space_complexity: str#
- Return type:
str
- property worst_case_delete_description: str#
- Return type:
str
- property worst_case_delete_time_complexity: str#
- Return type:
str
- property worst_case_insert_description: str#
- Return type:
str
- property worst_case_insert_time_complexity: str#
- Return type:
str
- property worst_case_search_description: str#
- Return type:
str
- property worst_case_search_time_complexity: str#
- Return type:
str