finished code for kth biggest element