• Keine Ergebnisse gefunden

Algorithms and Data Structures Summer Term 2021 Exercise Sheet 8

N/A
N/A
Protected

Academic year: 2022

Aktie "Algorithms and Data Structures Summer Term 2021 Exercise Sheet 8"

Copied!
1
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

University of Freiburg Dept. of Computer Science Prof. Dr. F. Kuhn

Algorithms and Data Structures Summer Term 2021

Exercise Sheet 8

Exercise 1: Graph Representations

Give the following graphs as adjacency matrix andadjacency list.

(a)

1

2

3

5 4

(b) 1

2

3

4

5

6

(c)

1

2 3

4 5

6

Exercise 2: Breadth First (BFS) and Depth First Search (DFS)

For the following graphs, give the order in which nodes are visited (marked) when running BFS and DFS. Moreover, mark the resulting spanning trees in the respective graph. Start with the node with identifier 1. Whenever there is a choice, mark the node with smallest identifier first.

(a)

1

2 3 4

5 6 7

(b)

1

4 3

2 5 8

6 9

7 10

Exercise 3: Check for Cycles

(a) Let G= (V, E) be an undirected graph represented by an adjacency list. Describe an algorithm that tests in O(|V|) steps whether Ghas a cycle.

(b) Argue why your algorithm is correct and has the desired running time.

Referenzen

ÄHNLICHE DOKUMENTE

Therefore, we consider the Vertex Cover problem: The task is to cover edges in a graph where an edge can be covered by its incident vertices.. We are interested in finding a

Note that you should see this also as a chance to talk about definitions, proof ideas and techniques in addition to only working out a formal solution for the tasks. If you do not

Thomas Kesselheim July 1, 2021 Alexander Braun.. Algorithms and Uncertainty Summer

Afterwards we get to know which of the k results the user was interested in and incur a cost of j if this was the j th result in our order. Model this problem as an online

Show that the Entropical regularizer is η 1 -strongly convex with respect to the ` 1 -norm in the experts setting. Hint: Pinsker’s inequality can be

Therefore, consider an α-competitive online algorithm for the online Steiner tree problem on complete graphs satisfying the triangular inequality (a.k.a. metric Steiner tree

You should reuse algorithms and results from the lectures.. Exercise 2:

If there is a cycle, one must be found after looking at the first n edges, since n edges must necessarily have a cycle in a graph with