> For the complete documentation index, see [llms.txt](https://cs61b-2.gitbook.io/cs61b-textbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cs61b-2.gitbook.io/cs61b-textbook/24.-shortest-paths/24.5-exercises.md).

# 24.5 Exercises

## Procedural

Questions 1 and 2, suppose we run Dijkstra's from A. Break ties alphabetically. Breaking ties alphabetically means that if we insert B into the fringe, and C is in the fringe with the same priority, we have a tie! To break this tie, we will do so alphabetically, putting B before C.

1. What is the order that vertices are visited? Please separate vertices with spaces, e.g. A B C ....
2. Select all the edges in the shortest paths tree. \*

<figure><img src="/files/uLekXFXzTYl3ZnlCerqw" alt=""><figcaption></figcaption></figure>

<details>

<summary>Problem 1</summary>

A B E C F D G

For this, and all questions on this check in, refer to this walkthrough video for an explanation: [https://youtu.be/5MFOu8bNvd8](https://www.google.com/url?q=https://youtu.be/5MFOu8bNvd8\&sa=D\&source=editors\&ust=1679291837950894\&usg=AOvVaw3zdQsT2ly7PQQGYjid7E6m)

</details>

<details>

<summary>Problem 2</summary>

AE

AB

CE

DF

EG

EF

</details>

For questions 3-5, suppose we run A\* from A to D. Break ties alphabetically

3. What is the order that vertices are visited? Note that not all vertices need be visited. Please separate vertices with spaces, e.g. A B C ....
4. Select all the edges in the shortest path from A -> D, as determined by A\*. Note that this may not be the correct shortest path. Also note that we are NOT finding the shortest path tree, but just the edges on the shortest path!
5. In the previous question, you probably noticed that the actual shortest path from A -> D was not found! The reason for this is because the value of one heuristic is too high. Determine which heuristic this is, and what is the maximum its value can be so that A\* returns the correct shortest path.

<figure><img src="/files/1VZnSFmTxYDffRjgdQeG" alt=""><figcaption></figcaption></figure>

<details>

<summary>Problem 3</summary>

A E C B D

</details>

<details>

<summary>Problem 4</summary>

AE

CD

CE

</details>

<details>

<summary>Problem 5</summary>

F:2

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cs61b-2.gitbook.io/cs61b-textbook/24.-shortest-paths/24.5-exercises.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
