My own answer is binary search tree with next pointer, like this:

 struct Node{
    int key;
    Node* left;
    Node* right;
    Node* next; 
    Node* parent;
};
typedef struct Node MyNode;
MyNode* myTable;
MyNode* leftNode;

am I right, or is there some other answer?

1 Answers

0
Gianluca Ghettini On

You need a Heap: https://en.wikipedia.org/wiki/Heap_(data_structure)

insertion is O(logN)

find-min is O(1)