DSAVisualiseData Structures & Algorithms Studio
Paths & Grids Hard

Dijkstra: Toroidal Grid Climbing

Dijkstra’s algorithm finds the minimum total height-change cost on a grid that wraps at every edge.

Trace input

Bounded JSON

Edit the lesson input, then build a deterministic source-linked trace.

This lesson validates its own input and operation limits.

Source scenarios

Complexity

BestO(RC log(RC))
AverageO(RC log(RC))
WorstO(RC log(RC))
SpaceO(RC)

Array state

Follow the active comparisons and writes.

Live snapshot

Current operation

Trace state
Ready to explore
Source behavior & common mistakes

Find the least sum of absolute height differences between orthogonal neighboring blocks, including toroidal wraparound.

  • Forgetting that the mine wraps horizontally and vertically.
  • Using the largest single climb instead of summing climb times.
  • Processing stale priority-queue entries.

Algorithm code

Java
MineClimbing.javaStep linked
The highlighted line follows the current step.

Ready to begin

Press Play to see what happens.

Detailed execution
Snapshot 1 / 1