Question: Stack The class should own (as an instance variable) an instance of ArrayDeque or LinkedList and implement its own operations only with forwarding calls to


Stack The class should own (as an instance variable) an instance of ArrayDeque or LinkedList and implement its own operations only with forwarding calls to the operations of the encapsulated container. Implement the class Stack, including the following operations: push Takes a parameter and adds its value onto the stack pop Removes the item off the top of the stack and returns its value If the stack is empty, return None get_size Returns the number of items currently on the stack O O . O from array_deque import ArrayDeque from my_linked_list import Linkedlist class Stack: def _init__(self): # Pick one of these to use. # Stack must have the container you dont choose for Queue #self.container = Linkedlist() #self.container = ArrayDeque() pass def push(self, data): pass def pop(self): pass def get_size(self): return def _str_(self): return
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
