Practices
1) Describe an algorithm with time complexity O(n log n) that takes a sorted array A and
integer x, and determines whether there exist two elements in A whose sum is exactly x.
If so, it returns TRUE otherwise returns FALSE.
2) Assume that A is a sorted array with distinct integer numbers like this:
A = [ − 3, 1, 4, 5, 7, 10, 12, 15]
Write a pseudo-code for a procedure that returns i such that A [ i ] = i. It returns -1 if
there is no such element. The time complexity of the algorithm should be 𝑶(𝐥𝐨𝐠 𝒏)