Yes there is some way. In C++ it has own implementation called nth_element and works in *O(n)* time complexity.

The approach is similar like in quicksort. Pick some element as pivot *x* and reorder array such there are elements smaller than *x*, equal to *x* and greater. Notice, that they don’t need to be sorted in these sections. Now you can easily discard one of these sections - if there are more than *n* elements smaller than *x* the answer must be here and you can throw away greater elements. And simililar if there are fewer elements smaller than *x*. Now you can continue on smaller array. This should be *O(n)* if in each iteration you discard half of actual array. And if you choose pivot randomly, there is a high probability of doing so.

There is also deterministic *O(n)* algorithm, but it’s more complicated. Try to chceck this or google for “median of five” algorithm.