Which class of algorithms would this sort of a problem belong to? If I had to pick up a book on algorithms, which topic should I be looking at to find more problems of this nature and their explanation?
Given the current location on of the horse (or whatever the thing is that moves two spaces horizontally and one vertically) on a chess board, say, (x1, y1), how many steps would you need to move it to reach a destination location (x2, y2)?
-
1You should better ask which class of algorihm can solve this problem. Usually a problem can be solved by different classes of algorothms.Frank Puffer– Frank Puffer08/14/2016 09:06:25Commented Aug 14, 2016 at 9:06
-
That chess piece is called a Knight.Sjoerd– Sjoerd08/14/2016 16:59:40Commented Aug 14, 2016 at 16:59
1 Answer 1
This would be a pathfinding algorithm which would be part of graph theory.
Example algorithms include A* and Dijkstra's algorithm.