suppose that we have some while loop that runs at most n^2 times
if the while loop runs only when an element exists in an array(you have to find the element and it's index) then does that mean that the complexity is O(n^3)?
thanks in advanceCode:
bool find(int &i, array){
int j;
for(j=0;j<size_of_array;j++){
if(array[j] == something) {
i = j;
break;
}
}
int main(void) {
...
while(find(...)){
run n^2 times
}
}