I am coding in Java and I need a sorted data structure of Integers that has a maximum of O(log(n)) insertion time and O(1) lookup by index. Is there an inbuilt data-structure that can do this, or if not, how do I program one myself?
I know that a Set can accomplish the first task, but to lookup element i, I would need to iterate over all the elements before i.