# Analysis of time complexity

**TEJASWI_D**#1

option D is correct .

**Explanation**: First sort the array which takes O(nlogn) time.Now use i and j variable ,set i to first element and j to the last element .Now calculate Sum=S[i]+S[j] and compare it with input x.Increment i if Sum is less than x otherwise decrement j.if Sum becomes greater than x then return S[ i] and S [j] since these are the numbers that have sum greater than x. This operation will take O(i+j) since max value of i+j can be n.,therefore this operation takes O(n) time

Total time will be O(nlogn +n) which is equal to O(nlogn)