1 votes 1 votes 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 asked Jul 11, 2017 • retagged Jun 22, 2022 by makhdoom ghaya Diksha Aswal 344 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 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 See all 4 4 Comments reply Diksha Aswal commented Jul 11, 2017 reply Follow Share why O(log n) ? 0 votes 0 votes Durgesh Singh commented Jul 11, 2017 reply Follow Share 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 votes 0 votes Diksha Aswal commented Jul 11, 2017 reply Follow Share I just want to know how you get O(log n ) ? 0 votes 0 votes Durgesh Singh commented Jul 11, 2017 reply Follow Share You can perform binary search on N elements which has time complexity of O(log n) 0 votes 0 votes Please log in or register to add a comment.