Essa empresa é sua?
How to get the k smallest element in O(klogk) time
Sigiloso
do you mean O(nlogn)? where n is size of array?
To find k smallest elements among n elements in total, efficient implementation takes O(n logk), using a binary heap of size k.
I think it was nlogn, otherwise if k = 1, O(1) seems impossible for unsorted array
Fique por dentro de todas as oportunidades e dicas internas seguindo as empresas de seus sonhos.
Comece a buscar vagas para receber atualizações e recomendações personalizadas.