• Keine Ergebnisse gefunden

Algorithms and Data Structures Summer Term 2021

N/A
N/A
Protected

Academic year: 2022

Aktie "Algorithms and Data Structures Summer Term 2021"

Copied!
2
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 7

Exercise 1: Red-Black Trees

(a) Decide for each of the following trees if it is a red-black tree and if not, which property is violated:

8

5

NIL NIL

NIL

9

8

NIL NIL

6

NIL NIL

6

4

NIL NIL

7

NIL NIL

(b) On the following red-black tree, first execute the operation insert(8) and afterwards delete(5).

Draw the resulting tree and document intermediate steps.

6

4

1

NIL 3

NIL NIL

5

NIL NIL

7

NIL 9

NIL NIL

Exercise 2: AVL-Trees

An AVL-tree is a binary search tree with the additional property that for each node v, the depth of its left and its right subtree differ by at most 1.

(a) Show via induction that an AVL-tree of heightdis filled completely up to depth bd2c.

A binary tree is filled completely up to depth d0 if it contains for all x ≤ d0 exactly 2x nodes of depth x.

(2)

(b) Give a recursion relation that describes the minimum number of nodes of an AVL-tree as a function of d.

(c) Show that an AVL-tree withnnodes has depth O(logn).

You can either use part (a) or part (b).

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