"Because I use the idea of partition-exchange,so the runtime complexity should be the same O(nlogn)" This logic does not hold. Partition-exchange itself is an O(N) operation, therefore, a program that uses partition-exchange could take at least O(N) time, but can be also arbitrarily high. So you can't say the running time is O(NlogN) is BECAUSE YOU USE Part-Ex.
Your program is not O(NlogN), but rather O(N). Think about it: in the 1st iteration, you do part-ex in T(N) time, and reduce the range by half. In the 2nd iteration, you do part-ex only on T(N/2), then reduce the range by another half. So in the end. You program takes T(N) + T(N/2) + T(N/4) + ... = T(2*N), which is O(N).