So my doubt is at line 2, here can we suppose that array2 is nested in array1, what would be the time complexity there from O(n^2) or O(n) why?
function1()
{
for-loop1{ function2(); } //line 2
}
function2()
{
for-loop2();
}
So my doubt is at line 2, here can we suppose that array2 is nested in array1, what would be the time complexity there from O(n^2) or O(n) why?
function1()
{
for-loop1{ function2(); } //line 2
}
function2()
{
for-loop2();
}
The Big O notation of your example is hard to decide since it does not run any actual function. You have to understand that Big O describes how the number of executions/calculations done relates to the input size.