I want to do line by line calculation of the running tie of following algorithm. I know it would be log N. However, before this I want to understand one statement:

Code:

`int midIndex = (endIndex - startIndex / 2) + startIndex; //problem statement`

startIndex = 0

then midIndex = 10

which is not correct. Somebody please guide me.

The algorithm is given below:

Code:

```
public int logarithmic(Integer[] data, int key) {
int startIndex = 0;
int endIndex = data.length - 1;
while (startIndex < endIndex) {
int midIndex = (endIndex - startIndex / 2) + startIndex;
int midValue = data[midIndex];
if (key > midValue) {
startIndex = midIndex++;
} else if (key < midValue) {
endIndex = midIndex - 1;
} else {
return midIndex;
}
}
return -1;
}
```

I would discuss about the line by line generation of running time afterwards. Some body please guide me about the problem statement above.

Zulfi.