path - algorithm to traverse points horizontally and vertically -


2D aircraft has n numbers. A robot wants to visit them all but can only take horizontal or vertical steps, how would it deliver them so that the total distance can be covered?

This is where the distance between each pair of digits is. Y2-y1 + | X2-x1 (Rectiliner distance or is called) It basically means that there is no known skilled solution.

On Wikipedia.

The simplest algorithm is a simple cruel power discovery, where you calculate the distance for each possible permutation, and the minimum find is the time to run the O (N!) It will work up to about 10 points , But it will be very slow for a large number of digits.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -