How can I find the sequence of this table?

43 Views Asked by At

how can I find the sequence of this table? I know that the algorithm I can use is binary search and that the complexity is O(log n), but I don't know how that sequence can be generated.

We have a vector of ordered integers of size 1,000,000. As shown in the example:

Posición Valor
0 -321
1 -21
2 321
3 1561
... ...
99,999 1,843,138
1,000,000 31,351,321

(a) Write an algorithm to find the position of the number 356,321.

(b) Describe the complexity of the algorithm that was implemented.