C program to find k-th element in an unsorted array in O(n)