I want to create a Red-Black Tree, with 2 values, (index, value) and I want to insert into the RB_tree based on the index.
So if I have the function: $\text{insert}(root, value, index)$ it will insert the value at $index$. However, because I insert based on the other indexes, if I insert at the index $1$ let's say, and I have already inserted at that index, then I would have to add to all the other node's indexes $+1$. The insert function is used only with valid indexes so, $index\in[0, size(RB\_tree)]$. What should I do to keep the insertion $O(\log n)$ and still have the indexes?