Time complexity

suppose while applying binary search in a program i am taking n inputs by using loop for(i=0;i<n;i++) instead of a[]={1,2,3,4,5}
will it change the time complexity from O(logn) to O(n)?

Taking in N inputs take O(N) time, So the overall complexity is O(N). So Yes.

1 Like