Meta Interview Question

How would you quickly find the kth smallest number in an unsorted array?

Interview Answers

Anonymous

Jan 9, 2016

Using heap is the right track

5

Anonymous

Jan 17, 2016

int findKthSmallestt(int[] a, int k) { Arrays.sort(a); return a[k-1]; }

3

Anonymous

Jan 21, 2016

Quick Select. O(n) time complexity.

1

Anonymous

Dec 18, 2015

quicksort and the traverse?