Advertisement
CaptainLepidus

Sort array

Mar 17th, 2012
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. array is formatted like this:
  2. array[0,0]=THE X OF THE FIRST POSITION
  3. array[0,1]=THE Y OF THE FIRST POSITION
  4. the goal is to sort array so that
  5. array[1,0],array[1,1]=THE CLOSEST POSITION TO array[0,0],array[0,1]
  6. And so on.
  7.  
  8. SAMPLE START:
  9. array[0,0]=10
  10. array[0,1]=10
  11. array[1,0]=0
  12. array[1,1]=0
  13. array[2,0]=5
  14. array[2,1]=5
  15.  
  16. SAMPLE FINISH:
  17. array[0,0]=10
  18. array[0,1]=10
  19. array[1,0]=5
  20. array[1,1]=5
  21. array[2,0]=0
  22. array[2,1]=0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement