user
Find the time complexity of this algorithm.
def linearSearch(arr, n, x): 
    for i in range (0, n): 
        if (arr[i] == x): 
            return i 
    return -1


assistant
The time complexity of this algorithm is O(n). This is because the algorithm will take a linear amount of time to run, since it has to iterate through the entire array in order to find the target item.