find the kth max value in C