Reputation: 417
I want to implement at least two different solutions to find N-th largest element with O(N*log(N)) average time complexity in Big-O notation, where N is the number of elements in the list ?
which searching algorithm should i use in my program in java to find to n-th largest element with regards to O(N*log(N)) ?
Upvotes: 0
Views: 361
Reputation: 70939
Actually the problem you are facing can be solve in linear time using the partitioning that is part of the quick sort
algorithm(Have a look here). If you really need and O(N*log(N))
algorithm than most efficient sorting algorithms will do - for instance quick sort, merge sort, heap sort.
Upvotes: 2