I was trying to solve this problem and I came up with a solution as below, which is quite different than the "Wikipedia" algorithm. I am failing to understand what is wrong with my solution, which is also O(nlogn).

**Input**: Set of co-ordinates along x-y axis. {(2,4),(5,3),(3,7),(4,2),(6,3)}

**My Solution:** 

1. Sort given set wrt x-coordinates. {(2,4),(3,7),(4,2),(5,3),(6,3)} .
Complexity O(nlog)
2. Find the min{distance between consecutive pair}, lets call it min\_x. 
Complexity O(n)
3. Sort given set wrt y-coordinates. {(4,2),(5,3),(6,3),(2,4),(3,7)} . Complexity O(nlog)
4. Find the min{distance between consecutive pair}, lets call it min\_y. Complexity O(n)
5. min\_d = min(min\_x, min\_y) the pair which resulted in min\_d is the pair with shortest distance.

Is this wrong? What am I missing?