Task 1:

a)

6.) We need to use logarithms to reveal a fibonacci like growth. Note that just because a proof by induction fails to bound , doesn’t mean that this is false. We need a concrete contradiction.

b)

2.) Remember the technique to get from to .

c) After comparisons of SelectionSort, what is the largest guaranteed number of sorted elements.

To find the first sorted element guaranteed, we need comparisons. For the second one we need comparisons. We can therefore upper bound for the amount of comparisons needed to find sorted elements with .

If we now fix , we find the number of sorted elements .

Task 2

d) How many different MSTs?

We need to check how many edges of the same weight there are that are actually in any MST.

Notice that the edges with weight 9 are not actually in any MST. The only choices we have are the multiple weight 3 edges. For the lower left, we choose 1 of 2 (2 possibilities) and in the upper right 2 of 3 (3 possibilities). Therefore we have different MSTs.

Task 3

a) Dynamic Programming

ii) Recursion We don’t need to check for in as this recursion is not an “optimality check” but a feasibility check (i.e. we check if because otherwise that entry doesn’t exist).

iii) Extraction We check all possible entries that are less than , not just the worst case of . In addition, we need to check that , for all possible .

b) MST problem

When you see undirected and minimal cost MSTs (not dijkstra’s, even though all edge weights are positive).

The solution here is to use extra vertices to enforce the constraints. By adding edges (guaranteed the smallest), from a start vertex to all power plants, we enforce the “no factory connected to more than one plant” condition using the no-cycle property of MSTs.

The runtime of setting up the graph is apparently, so take that into consideration for the runtime justification.

c) BFS layering

Make sure to add the waiting edges to the set of edges.

Make sure to give the start- and end-vertex in the new format and . We can use as we can just wait at .

Task 4

b)

Make sure to check that the counterexample actually fits the required criteria!!!! A graph with no eulerian cycle cannot disprove a statement requiring that the graph has a eulerian cycle!!!!!!!!

c)

ii) Check proof for logical holes. Arguing that there does not exist an edge since only works if is a cycle. Otherwise we could have which forms a cycle, with no source.