0% found this document useful (0 votes)
39 views3 pages

AStar SearchAlgorithm Exercise

DSA a star shortest path algorithm

Uploaded by

Myat Noe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views3 pages

AStar SearchAlgorithm Exercise

DSA a star shortest path algorithm

Uploaded by

Myat Noe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

A* Search Algorithm Exercise

Target node First Steps From Start Node


9 5 0 → 1 (and) 0 → 3
5 6
2 1 2 1. 0 → 1 = f(n) = g(n) + h(n)
6

7 4 = 2 + 16 = 18
0
2. 0 → 3 = f(n) = g(n) + h(n)
6 3 10
Start node
= 6 + 10 = 16

Target node
9 5
5 6
2 1 2
6

7 4
0
6 3 10 Second Steps
Start node
0 → 1 → 2 (and) 0 → 3 → 4 (and) 0 → 3 → 2
1. 0 → 1 → 2 = f(n) = g(n) + h(n)
= (2+5) + 6 = 13
2. 0 → 3 → 4 = f(n) = g(n) + h(n)
= (6+10) + 4 = 20
3. 0 → 3 → 2 = f(n) = g(n) + h(n)
= (6+7) + 6 = 19
Target node Third Steps
9 5 0 → 1 → 2 → 5 (and) 0 → 3 → 4 → 5 (and)
5 6
2 1 2 0→3→2→5
6

7 4 1. 0 → 1 → 2 → 5 = f(n) = g(n) + h(n)


0
= (2+5+9) + 0 = 16
6 3 10
Start node
2. 0 → 3 → 4 → 5 = f(n) = g(n) + h(n)
= (6+10+6) + 0 = 22
3. 0 → 3 → 2 → 5 = f(n) = g(n) + h(n)
= (6+7+9) + 0 = 22

Final selected paths to reach Target node : 0 → 1 → 2 → 5 (or) 0 → 3 → 4 → 5 (or) 0 → 3 → 2 → 5


The Shortest Path is 0 → 1 → 2 → 5.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy