• Aucun résultat trouvé

Le petit contrˆole pour le TD7

N/A
N/A
Protected

Academic year: 2022

Partager "Le petit contrˆole pour le TD7"

Copied!
2
0
0

Texte intégral

(1)

Le petit contrˆ ole pour le TD7

Execute us!

Exercice 1. Dijkstra Execution

Execute Dijkstra’s algorithm on the graph of Figure 1 starting at vertex A. If there are any ties, the vertex with the lower letter comes first. List the vertices in the order in which they are deleted from the priority queue and for each the shortest distance fromAto the vertex.

Figure 1: Graph for Problem 1.

Exercice 1. Answer A,0 D,3 B,4 G,4 C,6 E,6 F,7 Exercice 2. Prim Execution

Execute Prim’s algorithm on the graph of Figure 1 starting at vertex A. If there are any ties, the vertex with the lower letter comes first. List the edges in the order in which they are added to the tree.

Exercice 2. Answer (A,D) (D,G) (E,G) (C,E) (C,F) (B,C) Exercice 3. Kruskal Execution

Execute Kruskal’s algorithm on the graph of Figure 1 starting at vertexA.

Assume that equal weight edges are ordered lexicographically by the labels of their vertices assuming that the lower labeled vertex always comes first when specifying an edge, e.g. (C, E) is before (C, F) which in turn is before (D, G).

List the edges in the order in which they are added to the developing forest.

Exercice 3. Answer (C,E) (C,F) (D,G) (B,C) (A,D) (E,G) Exercice 4. BFS and DFS Execution

Give BFS and DFS trees for the following graph. Assume that BFS and DFS are initially called with the vertex a and that the edges are stored in the

1

(2)

adjacency lists in alphabetical order. Make sure you label which tree is a BFS tree and which is a DFS tree

Exercice 4. Answer The edge set (a, b),(b, c),(c, d)(d, e) is the DFS tree.

The edge set (a, b),(b, c),(b, d)(d, e). is the BFS tree

2

Références

Documents relatifs

The way we use the Green bundles in our article is different: the two Green bundles will bound the “derivative” below and above (this derivative is in fact the accumulation points

ASSOCIATION OF CANADA LANDS SURVEYORS - BOARD OF EXAMINERS WESTERN CANADIAN BOARD OF EXAMINERS FOR LAND SURVEYORS ATLANTIC PROVINCES BOARD OF EXAMINERS FOR LAND SURVEYORS ---..

Our run submis- sions for this task explore a number of techniques to achieve this: probabilistic models of workers (i.e. estimating which workers are bad, and discounting their

[r]

Simple metal Solid state Glass membrane Enzyme Liquid membrane Gas sensing We’ll review representative examples of each.. You can assume that the proper reference

Show that a Dedekind ring with finitely many prime ideals is

On the same cover sheet, please put your name, student number, and name of the degree (Maths/TP/TSM), and staple all the sheets together. (Failure to do that may result

Furthermore, another breakthrough made by Muto ([Mut]) showed that Yau’s conjecture is also true for some families of nonhomogeneous minimal isoparametric hypersurfaces with