retagged by
4,854 views

2 Answers

7 7 votes
O(1)  since the array is sorted we have to find the sum of first two elements only if their sum is less than 1000 than output will be yes if not than since the elements are sorted if the sum of first two elements is not less than 1000 than the sum of no two elements would be less than 1000 and output would be no.
0 0 votes
o(n)
Position:
Show:

Related questions

9 9 votes
2 answers 2 answers
23.4k
23.4k views
0 0 votes
2 2 answers
4.4k
4.4k views
0 0 votes
2 2 answers
1.9k
1.9k views
dhruba asked Jun 5, 2023
1,881 views
Binary search is performed on a sorted array of n elements. The search key is not in the array and falls between the elements at positions m and m+1 (where 1 ≤ m < n). Ho...
1 1 vote
2 answers 2 answers
2.4k
2.4k views
Akriti sood asked Dec 27, 2016
2,439 views
Consider the array of size n. the first (n – 1) elements are already sorted. What is the worst case time complexity to insert a nth element in an array after insertion th...