Algorithm project - finding kth value in O(n)