Question: What is the runtime complexity of adding an item to a stack and removing an item from a stack?
- Add items to a stack in O(1) time and remove items from a stack on O(n) time.
- Add items to a stack in O(1) time and remove items from a stack in O(1) time.
- Add items to a stack in O(n) time and remove items from a stack on O(1) time.
- Add items to a stack in O(n) time and remove items from a stack on O(n) time.
Answer: The correct answer of the above question is Option B:Add items to a stack in O(1) time and remove items from a stack in O(1) time.