I'm learning how to write theoretical analysis for the running time of algorithms and I am wondering if it's correct to say for the following code:
while(high >= low) {
loop body here....
high--;
low++;
}
Where low begins at index 0, and high begins at index N - 1, for an array of N integers. The loop body will run (n / 2) times, or it will make (n / 2) + 1 comparisons. Is it correct to say this? And if so, to get the complete run time analysis for the whole function, would you then evaluate any inner loops to create a complete function for the run time?