Frage im Vorstellungsgespräch bei Visible Alpha

Round 2: Find Kth max element from unsorted array.

Antwort im Vorstellungsgespräch

Anonym

1. Jan. 2019

The standard answer for this is to use max binary heap, which will provide you answer in O(nlogn) but I did not knew about that so I said I will start sorting the array using quick sort and will stop sorting when I find kth max, so no need to sort complete array and hence complexity is less than O(n) on average.