Home > Software engineering >  Two-dimensional coordinate scheduling problems, and don't know anyone before, can you give me a
Two-dimensional coordinate scheduling problems, and don't know anyone before, can you give me a

Time:10-02

Concrete is this: there is a array arr (I, 1), the arr (I, 0) on behalf of the X coordinates, arr (I, 1) on behalf of the Y coordinate, these points are rows, such as a row of 10 points, the second row of four points, the third row 6 so rows, one row of point's Y coordinate were similar, but not completely equal,

Question: we used is from left to right, from the top down, do the point of a sort, as we count the number of points, after a row number, and then the next row,

If the great spirit saw, don't spray,,,

Ordinary sort code to search on the net, but this I really have no idea, the problem is that each row number and row number is not sure,
A great god, please give a train of thought, if you have the source code will be better ~ ~ ~ ~

CodePudding user response:

You an example to explain how to order...

CodePudding user response:

Whatever you use what sort algorithm,
Need to change is to compare the size of original & gt; , & lt; In comparison with a custom function realization,
Implement your own rules within the function:
Row such as o=Int (Y) \ 10, divide the Y coordinates into highly 10 rows,
To compare the first row size, on the same row and then compare the size of the X,

CodePudding user response:

reference 1st floor Topc008 response:
you an example to explain how to order...


| @ 1 @ 2 @ 3
| @ 4 @ 5 @ 6
| @ @ 7 8
|
X -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

The above @ representative points, for example, Numbers for the order of the sort, this order is not pure sort according to x or y




CodePudding user response:

refer to the second floor Tiger_Zhao response:
what do you use on sorting algorithms,
Need to change is to compare the size of original & gt; , & lt; In comparison with a custom function realization,
Implement your own rules within the function:
Row such as o=Int (Y) \ 10, divide the Y coordinates into highly 10 rows,
To compare the first row size, on the same row and then compare the size of the X,


Thanks for advice on the second floor

CodePudding user response:

http://bbs.mjtd.com/thread-111364-1-1.html
Look here, there is the source code
  • Related