Is there a data structure that has the following properties?
every element has a natural ordering as well as a key (arbitrary string or int).
Maintains ordering of elements according to their natural ordering. For example, after I insert the integers in this order: 0, 2, 3, 1, I must be able to traverse it in this order: 0, 1, 2, 3 (natural ordering).
Fast retrieval of an element according to its key, which can be arbitrary.
Insertion and retrieval should have sublinear time complexity.
You could say it is a combination of a tree and hashmap, or a tree sorted in 2 ways concurrently.
It doesn't really matter what the programming language of the code or library you're pointing me to is, I can do the necessary translation.
0, 2, 3, 1, and also in the order0, 1, 2, 3?