1 1 vote What is the method to find the time complexity to search an element which appears more than 20% in sorted array having n elements. and also for 1% or 40% . Algorithms time-complexity sorting + – Diksha Aswal 764 views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
0 0 votes O(logN) As asymptotic complexity is dependent on data space only which is N. Durgesh Singh answered Jul 11, 2017 Durgesh Singh comment Share Follow See all 4 Comments 4 4 Comments reply Diksha Aswal commented Jul 11, 2017 reply Follow flag why O(log n) ? 0 0 replyShare Durgesh Singh commented Jul 11, 2017 reply Follow flag Please see the definition of asymptotic running time complexity of algorithm- It does not depend on nature of data. It does not depend on platform on which algorithm is run. In the question if you mean actual running time of algorithm then we can not say as it will depend on above two factors. Please correct me if my analogy is wrong. 0 0 replyShare Diksha Aswal commented Jul 11, 2017 reply Follow flag I just want to know how you get O(log n ) ? 0 0 replyShare Durgesh Singh commented Jul 11, 2017 reply Follow flag You can perform binary search on N elements which has time complexity of O(log n) 0 0 replyShare Please log in or register to add a comment.