retagged by
313 views

3 Answers

1 votes
1 votes
As if array is not sorted so you have to scan array min one time .so Time complexity is O(n).
0 votes
0 votes
I am getting option a O (n)

In this question array is not sorted .

Therefore we have to scan array one time

So answer is O (n).
0 votes
0 votes
Here it has not been mentioned that array is sorted or not. So binary search can not be applied here. So, to find out elements at last you have to traverse the whole array which will take time of order n

i.e O(n)+O(n-1)+O(n-2)=O(n)

Related questions

2 votes
2 votes
1 answer
1
0 votes
0 votes
1 answer
2
rajan asked Dec 9, 2016
373 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,891 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