Which one is better, Implementing a stack to get minimum element or maintaing a heap data structure to extract minimum element. Both gives minimum element in O(1) (If you implement 2 stack, one with minimum element and another stack with actual input). 

Explain me, under which situations we can use Stack or heap to extract minimum or maximum element and why