0% found this document useful (0 votes)
12 views

Tutorial 3

This document outlines the expectations and exercises for Tutorial 3 of the MTH6105 - Algorithmic Graph Theory course. Students are expected to attempt all exercises before the tutorial and actively participate. The exercises cover proving properties of trees, analyzing algorithmic complexity, and analyzing Euclid's algorithm for finding the greatest common divisor of two numbers.

Uploaded by

adrverhar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Tutorial 3

This document outlines the expectations and exercises for Tutorial 3 of the MTH6105 - Algorithmic Graph Theory course. Students are expected to attempt all exercises before the tutorial and actively participate. The exercises cover proving properties of trees, analyzing algorithmic complexity, and analyzing Euclid's algorithm for finding the greatest common divisor of two numbers.

Uploaded by

adrverhar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

MTH6105 – Algorithmic Graph Theory Spring 2023

Tutorial 3 F. Fischer

You are expected to attempt all exercises before the tutorial and to actively par-
ticipate in the tutorial itself.

1. Show that a graph G is a tree if and only if it contains no loops and a unique
u−v-path for every u, v ∈ V (G).
(a) For the direction from right to left, consider a graph G without loops and with
unique u−v-paths, and show that G is connected and acyclic.
(b) For the direction from left to right, show that if T is a tree, then it contains
unique u−v-paths.
2. (a) For functions f, g, h : N → R+ show the following:
(i) f (n) + g(n) is O(max{f (n), g(n)}).
(ii) if f (n) is O(g(n)) and g(n) is O(h(n)), then f (n) is O(h(n)).
(b) Let f (n) = a0 + a1 n + a2 n2 + a3 n3 , where a0 , a1 , a2 , a3 ∈ Z are constants. Show
that f (n) is O(n3 ).
(c) Show that 22n is not O(2n ). To this end, you may want to assume that it was
and derive a contradiction.
Note: This type of question looks intimidating, but really it is all bark and no
bite. Recalling the relevant definition, all we need to do to show that f (n) is O(g(n))
is find constants c and n0 with certain properties and verify that they indeed satisfy
these properties.
3. Euclid’s algorithm determines the greatest common divisor gcd(a, b) of two non-
negative integers a ≥ b by setting r0 = a, r1 = b, and then repeating the following
steps for rounds n = 2, 3, 4, . . . :
• If rn−1 = 0 then stop, output gcd(a, b) = rn−2 .
• Find qn and rn such that rn−2 = qn rn−1 + rn and 0 ≤ rn < rn−1 .
Note that (rn )n≥0 is a decreasing sequence of non-negative integers and the algorithm
thus stops after a finite number of rounds. Note further that it makes sense to say
that the size of the input of the algorithm is log2 a + log2 b, because this is the
number of digits of a and b as binary numbers.
(a) If rn were to decrease by 1 in each round, how many rounds would the algorithm
run for?
(b) Show that rn in fact decreases significantly over two consecutive rounds of the
algorithm, namely rn < rn−2 /2. You may want to distinguish among the three
cases where rn−1 = rn−2 , rn−2 /2 < rn−1 < rn−2 , or rn−1 ≤ rn−2 /2.
(c) Give an upper bound on the maximum number of rounds of the algorithm in
terms of the size of the input to the problem. You may want to argue that
after a certain number k of rounds, rk < 1 and the algorithm must therefore
have stopped.

You might also like