edited by
626 views
0 votes
0 votes

 

edited by

1 Answer

1 votes
1 votes

answer should be O(nlgn).

traverse the every element of the set. For each element  a1, the pair would be n = (S - a1 ).  Find "n" using Binary Search in O(lgn) time.

Thus, total time  = n*lgn.

Time complexity = O(n*lgn)

Related questions

0 votes
0 votes
2 answers
1
Avik Chowdhury asked Aug 17, 2018
377 views
Is the given answer correct?
0 votes
0 votes
1 answer
2
rajan asked Dec 9, 2016
352 views
how to solve these two using matser thorem.1. t(n)=2t(√n)+n2. t(n)=4t(√n)+(logn)^2
1 votes
1 votes
2 answers
3
vijaycs asked Jul 11, 2016
1,842 views
On which of the following recurrence relation Masters theorem can not be applied ?A. T(n)= 2T(n/2) + n (log n).B. T(n) = T(n/2) + 1.C. T(n) = 8T(n/2) + (log n).D. T(n) = ...
0 votes
0 votes
2 answers
4