• Nem Talált Eredményt

Combinatorial optimization, 1st midterm, 2022

N/A
N/A
Protected

Academic year: 2022

Ossza meg "Combinatorial optimization, 1st midterm, 2022"

Copied!
4
0
0

Teljes szövegt

(1)

Combinatorial optimization, 1st midterm, 2022

You can receive 10 points for each problem. Reasoning is necessary. A plain answer with no reasoning worth zero points even if the answer is correct. Read the problems carefully. Some problems contain multiple parts.

1. Consider the functionf(n) = (5n2−3n+ 2)·(log2n+√ n). (a) Is f(n)∈O(n3)?.

(b) Is f(n)∈Θ(n3)?

If the answer is yes, then give an N, c pair which satises the denition of O or Ω . Otherwise prove that the answer is no.

Solution:

5n2−3n+ 2 ≤5n2 if n ≥2. (1 point) log2n≤n if n≥1,√

n ≤n if n ≥1(1 point) Thereforef(n)≤5n2·2n = 10n2 if n ≥2. (1 point)

Soc= 10, N = 2 satises the denition of O(n3), thus fn∈O(n3). (1 point) p(n)≥log2(n) if n≥4. (1 point)

Indirectly assume that f(n)∈Ω(n3), so there is a c > 0and N, such that for all n≥N: (5n2−3n+ 2)·(log2n+√

n)≥cn3. (1 point)

If I increase the left hand side, then it is still bigger than cn3 if n ≥max(N,4): 5n2·2√

n= 10n2.5 ≥cn3 (1 point)

Since n is positive, we can divide both sides by cn2.5: 10/c ≥√

cfor all n if n≥max(N,4) (1 point) But this is a contradiction, since √

n is not bounded by above when n→ ∞. (1 point) Sof(n)∈/ Ω(n3), and thereforef(n)∈/ Θ(n3). (1 point)

2. Consider the following edge weighted graph.

D

G H

C

B A

J I

E

7 4

3 2

3 8 3

6 4 2

1

3 8 5

6 1

8

(a) Find a minimum weight spanning tree in this graph.

(2)

(b) We increase the weigth of edge {G,H}. What is the largest possible weight of this edge if we know that the obtained edge weighted graph has a spanning tree whose weight is not bigger than 24? (The other edge weights have not been changed.) Solution

(a) The red edges form one of the possible minimum weight spannign trees. A minimum weighted spanning tree worth 4 points.

We found it by Kruskal's algorithm./Some reasoning. (1 point)

(b) The weight of the minimum weight spanning tree is 22 and it contains the {G,H}

edge. (1 point)

If we throw out the {G,H} edge and nd the minimum weight spanning tree in that graph, then its weight is 27. (It contains {G, A} instead of {G, H}). (1 point) Therefore any spanning tree which does not contain {G, H} has weight more than 24. (1 point)

So if we increase the weight of {G,H} edge byx to1 +x, then the red edges form a minimum weight spanning tree of weight 22 +x. if x≤5 (1 point)

So the maximum increasement x, when there is a spanning tree of weight 24, is 2.

So the largest possible weight of {G,H} is 3. (1 point)

3. Use Dijkstra's algorithm to calculate the distances between A and every other vertex in this undirected graph. Write down the set and the tables which contain the calculations.

Give a shortest path between A and G.

1 14

8

2

5

4

10 2 3 2

1

6

A B C

D

F G

E

Solution

The table containing the upper bounds worth 4 points.

The FINISHED set worth 2 points.

The table tracking the shortest paths worth 2 points.

A shortest path is ADEF CG (2 points)

(3)

4. Consider the following graph.

1 2 3 5 6

9

4

10 11 12 13

7 8

(a) Find a maximum matching in this graph. Give a reasoning why is that maximum.

(b) Does this graph contain a vertex cover set whose size is 5?

Solution:

(a) The red edges form a maximum matching. (4 points)

It is maximum because there is no augmenting path (1 point), because there is only one uncovered vertex and an augmenting path needs two. (1 point)

OR

There are 13 vertices, sob13/2c= 6 is an upper bound on the size of a matching in this graph. The size of this matching is 6, therefore it is a maximum matching. (2 points)

(b) The size of the maximum matching is 6. (1 point)

Therefore the size of a minimum vertex cover is at least 6. (1 point)

The size of a vertex cover cannot be smaller than the size of a minimum vertex cover.

(1 point)

So there is no vertex cover whose size is 5. (1 point) 5. Consider the following decision problem:

Input: An undirected graphG and two of its vertices: u, v.

Question: Is there a vertex x such that dist(x, u) ≤ 100 and dist(x, v) ≤ 100? (dist denotes the graph theoretical distance)

Show that this decisision problem is in class P.

Solution SinceG is undirected, dist(x, u) =dist(u, x). (1 point) We start a BFS from u and start a BFS fromv. (2 points)

We obtain the distance from u and the distrance from v for each vertex of the graph. (1 point)

We check these distance pairs for each vertex one by one. If there is a vertex where both numbers are not bigger, than 100 then OUTPUT YES, otherwise OUTPUT NO. (2 points)

This decision problem is in P, because this algorithm decides it and its time complexity is polynomial. (1 point)

Because:

The BFS runs in O(e+n) steps. So, two BFS run inO(e+n) steps. (1 point)

(4)

Comparing two values to 100 at a vertex can be done in constant steps, so doing it for all vertices can be done inO(n)steps. (1 point)

So the time complexity of this algorithm is in O(n+e), which is polynomial in the size of the input, which is in Ω(n+e). (1 point)

OR

We start a BFS algorithm from each vertex. (2 points) We obtain the distance between any two vertices (1 points).

If there is a run of a BFS, when the distance ofufrom the root≤100and the distance of v from the root≤100, then STOP and output YES, otherwise at the end of the algorithm OUTPUT NO. (3 points)

This decision problem is in P, because this algorithm decides it and its time complexity is polynomial. (1 point)

Because:

The BFS runs in O(e+n) steps.

We run at mostnBFS, so the time complexity is inO(n(n+e))⊆O((n+e)2). (2 points) Which is polynomial in the size of the input, which is in Ω(n+e). (1 point)

Hivatkozások

KAPCSOLÓDÓ DOKUMENTUMOK

Exercise and recreation professionals aim to improve the population’s health behavior; thus, they are expected to have broad-ranging knowl- edge about the topics of weight

The crossing number cr (G) of a graph G is the minimum possible number of edge-crossings in a drawing of G, the pair-crossing number pair-cr (G) is the minimum possible number

Together with Lemma 2, this implies that the list edge multicoloring problem also can be solved in polynomial time if the graph has full edge rank.. Theorem 4 List edge

If G is a regular multicolored graph property that is closed un- der edge addition, and if the edge-deletion minimal graphs in G have bounded treewidth, then the movement problem can

If G is a regular multicolored graph property that is closed under edge addition, and if the edge-deletion minimal graphs in G have bounded treewidth, then the movement problem can

The crossing number cr (G) of a graph G is the minimum possible number of edge-crossings in a drawing of G, the pair-crossing number pair-cr (G) is the minimum possible number

Proof: If it has a face which is not a triangle, then adding a diagonal of that increasing the edge number but keeping the graph planar. But a graph having 3n-5 edges is

A fractional edge cover is a weight assignment to the edges such that every vertex is covered by total weight at least 1.. ̺ ∗ (H ) : smallest total weight of a fractional