The document contains a Java class named Pathfinding that implements Dijkstra's algorithm to find the shortest path in a grid. It initializes a distance array, uses a priority queue to explore possible paths, and updates distances based on movement until boundaries or obstacles are encountered. The method returns the shortest distance to the destination or -1 if unreachable.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
3 views
generalDijikstra
The document contains a Java class named Pathfinding that implements Dijkstra's algorithm to find the shortest path in a grid. It initializes a distance array, uses a priority queue to explore possible paths, and updates distances based on movement until boundaries or obstacles are encountered. The method returns the shortest distance to the destination or -1 if unreachable.