Why was the loop for i not taken into consideration while calculating the complexity? Im confused
first loop runs = N/2 times
second loop runs = N times
now according to the time complexity we reach N/2+N
Now if N tends to infinity then N/2 is very small compared to N. Hence can be neglected.
O(N) is the final answer.
How are we adding N/2+N? It needs to be multiplied (n/2 * n), is n’t it?