Design a getMin() method with constant, O(1), runtime.
Anonymous
Not an answerable question with no additional information. One possibility is a min heap. The minimum value will always be the root node in the tree. But something like a plain array and you'll need to traverse the whole thing every time, so O(n). You could encapsulate an array in another class that keeps track of the min as you add elements, though, and that could run in O(1).
Check out your Company Bowl for anonymous work chats.