data_structures.stacks.stack_with_doubly_linked_list¶
Attributes¶
Classes¶
Module Contents¶
- class data_structures.stacks.stack_with_doubly_linked_list.Stack¶
Bases:
Generic
[T
]>>> stack = Stack() >>> stack.is_empty() True >>> stack.print_stack() stack elements are: >>> for i in range(4): ... stack.push(i) ... >>> stack.is_empty() False >>> stack.print_stack() stack elements are: 3->2->1->0-> >>> stack.top() 3 >>> len(stack) 4 >>> stack.pop() 3 >>> stack.print_stack() stack elements are: 2->1->0->
- __len__() int ¶
- is_empty() bool ¶
- pop() T | None ¶
pop the top element off the stack
- print_stack() None ¶
- push(data: T) None ¶
add a Node to the stack
- top() T | None ¶
return the top element of the stack
- data_structures.stacks.stack_with_doubly_linked_list.T¶