Dijkstra’s vs A* Pathfinding Algorithms
Compare Dijkstra’s and A* algorithms: shortest path search, heuristics, and differences in pathfinding efficiency. 🔍

onjsdev
19.2K views • Sep 16, 2025

About this video
🔹 Dijkstra’s Algorithm
What it does: Finds the shortest path from a start node to all other nodes in a graph.
Heuristic: ❌ None (it doesn’t “guess” distance, just explores all possible paths).
Performance: Can be slow on large graphs, since it explores many unnecessary nodes.
Guarantee: Always finds the shortest path.
Use cases:
- Network routing
- GPS when no heuristic is available
- General shortest-path problems
🔹 A Algorithm*
What it does: Finds the shortest path from a start node to a target node efficiently.
Heuristic: ✅ Uses a heuristic function f(n) = g(n) + h(n)
- g(n) = cost so far
- h(n) = estimated cost to goal (heuristic)
Performance: Much faster, explores fewer nodes than Dijkstra (if heuristic is good).
Guarantee: Finds the shortest path if the heuristic is admissible (never overestimates).
Use cases:
- Pathfinding in games (NPC navigation, maps)
- Robotics movement
- GPS navigation with heuristics (like straight-line distance)
#datastructures #datastructureandalgorithm
What it does: Finds the shortest path from a start node to all other nodes in a graph.
Heuristic: ❌ None (it doesn’t “guess” distance, just explores all possible paths).
Performance: Can be slow on large graphs, since it explores many unnecessary nodes.
Guarantee: Always finds the shortest path.
Use cases:
- Network routing
- GPS when no heuristic is available
- General shortest-path problems
🔹 A Algorithm*
What it does: Finds the shortest path from a start node to a target node efficiently.
Heuristic: ✅ Uses a heuristic function f(n) = g(n) + h(n)
- g(n) = cost so far
- h(n) = estimated cost to goal (heuristic)
Performance: Much faster, explores fewer nodes than Dijkstra (if heuristic is good).
Guarantee: Finds the shortest path if the heuristic is admissible (never overestimates).
Use cases:
- Pathfinding in games (NPC navigation, maps)
- Robotics movement
- GPS navigation with heuristics (like straight-line distance)
#datastructures #datastructureandalgorithm
Video Information
Views
19.2K
Likes
157
Duration
0:07
Published
Sep 16, 2025
User Reviews
4.2
(3) Related Trending Topics
LIVE TRENDSRelated trending topics. Click any trend to explore more videos.
No specific trending topics match this video yet.
Explore All Trends