What is the time complexity of a linear search performed using 2 pointers? For an array, I'm using a left pointer (pointing to 0) and a right pointer (pointing to end).
For every iteration, if my search element is not found, I increment left and decrement right.
This iteration continues until left &lt;= right. Find the code snippet below
left = 0
right = length - 1

while left &lt;= right:
    // search logic
    left += 1
    right -= 1


What will be worst the time complexity of this algorithm?
Also, is this a type of linear search?
$O(n)$, since you still will go through the entire array.
And yes, this is a linear search since $O(n)$ is linear.