An O(n logn) algorithm for the convex bipartite matching problem