Consider the following algorithm: procedure f(arr, T): i…
Consider the following algorithm: procedure f(arr, T): i = 0 j = length(arr) – 1 while i < j: if arr[i] + arr[j] == T: return (arr[i], arr[j]) else if arr[i] + arr[j] < T: i = i + 1 else: j = j - 1 return null What is the time complexity of the algorithm?
Read Details