implement kthSmallest and kthLargest