A
is a sorted list. B
is a sorted list, and a subset of A
.
If an element is inserted into A
at index i
what's the most efficient way to determine the correct index i'
for it's position in B
?
Given the fact that both lists are sorted, and that we know B
is subset of A
I would think we should be able to devise quite an efficient algorithm, but I'm not happy with what I've come up with so far.
Thanks!