0 votes 0 votes Algorithms algorithms time-complexity normal testbook-test-series + – monty asked Dec 29, 2016 • retagged Jul 9, 2022 by Lakshman Bhaiya monty 313 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
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). sachin! answered Dec 29, 2016 sachin! comment Share Follow See all 0 reply Please log in or register to add a comment.
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). Deepak Yadav answered Jan 1, 2017 Deepak Yadav comment Share Follow See all 0 reply Please log in or register to add a comment.
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) Anup patel answered Jan 1, 2017 Anup patel comment Share Follow See all 0 reply Please log in or register to add a comment.