PyDS package¶
Subpackages¶
Submodules¶
PyDS.Error module¶
- exception PyDS.Error.Empty¶
Bases:
Exception
Error attempting to access an element from an empty container.
PyDS.Node module¶
- class PyDS.Node.DoublyNode(value: Any, next: Optional[Node], prev: Optional[Node])¶
Bases:
PyDS.Node.Node
- prev: Optional[PyDS.Node.Node]¶
- class PyDS.Node.Node(value: Any, next: Optional[PyDS.Node.Node])¶
Bases:
object
Implementation of Node containing a value and pointing to the next node.
- next: Optional[PyDS.Node.Node]¶
- value: Any¶
PyDS.Stack module¶
- class PyDS.Stack.Stack(_Stack__capacity: int = 64, _Stack__list: List[Any] = <factory>, _Stack__size: int = 0)¶
Bases:
object
Implementation of Stack ADT
- Parameters
__capacity (int) – The maximum number of elements a container can hold
__list (List[Any]) – A container that holds elements in stack
__size (int) – The number of elements in stack
- is_empty() bool ¶
Checks to see if stack is empty
- Returns
Whether or not the stack’s empty
- Return type
bool
- pop() Any ¶
Deletes value from top of stack
- Returns
A value from the top of the list
- Return type
Any
- push(value: Any) None ¶
Inserts value to the top of stack
- Parameters
value (Any) – A value to insert
- top() Any ¶
Grab top value of stack without deletion
- Returns
A value from the top of the list
- Return type
Any