A Common Interview Question
September 13, 2016
I’ve seen this question two or three times recently on message boards that provide interview questions, so I guess we ought to add it to our collection:
Create and implement a data structure that provides
- find min
- find max
- delete min
- delete max
all in O(1) time, regardless of the type of the underlying data.
Your task is to create and implement that data structure. When you are finished, you are welcome to read a suggested solution, or to post your own solution or discuss the exercise in the comments below.
Pages: 1 2