Time complexity for staircase search

can you please explain in detail how is the time complexity of staircase search O(N) and instructor says its nearly 2N which is also O(N).Please explain in detail how it is O(N) and That 2N part too

hello @kani001there are some notations of expressing the time complexity .
like big o notation (for worst case):
theta notation(average case):
omega notation for best case:
so according to him in big O notation the time complexity is O(N).
this he means if we talk about exact time complexity of the code it is O(2N) and in notations it is O(N).
if you still have doubt you can ask here .
Happy Learning !!

my question is how is it 2N,i can understand that it changes to O(N)…But on what basis or logic it is 2N,please explain in detail to get deep intuition of how it works

hey that means that algorithm will work in time complexity of O(N) but it can take atmost 2*n steps .
i.e, i from 0 to n and j from n-1 to 0