Design a stack which returns the minimum element in constant time O(1)

Problem statement : Design and implement a stack which returns the minimum element of the stack in constant time. The implementation should support other stack operations push(), pop(), peek(), getSize(), isEmpty(), isFull() in constant time with no degrade in performance and a getMin() method which returns the minimum element with O(1) time complexity. Prerequisites :Continue reading “Design a stack which returns the minimum element in constant time O(1)”

Design a site like this with WordPress.com
Get started