Find ith smallest element in an integer array