2014 09 Combinatorics I Letture Note
2014 09 Combinatorics I Letture Note
2007-11-8
1. (40%) For integers n and k satisfying n k 1, let Gn,k = (Vn,k , En,k ) be the graph with
Vn,k = {a1 . . . an : each ai = 0 or 1} and En,k = {{a1 . . . an , b1 . . . bn } :
Pn
i=1
|ai bi | = k}.
n
k
For the case of n = k, every vertex is adjacent to exactly one vertex which is its 1s
complement. So, in fact the graph is 2n1 K2 .
We now assume n > k. For any a Vn,k and any S {1, 2, . . . , n}, let a(S) be the
vertex a0 with a0i 6= ai for i S and a0j = aj for j
/ S. We first claim that for any a Vn,k
and 1 i < j n, there is a walk from a to a({i, j}). To see this, we choose a subset
A of k 1 elements from {1, 2, . . . , n} {i, j}. Then, a is adjacent to a(A {i}), which
in turn is adjacent to a({i, j}). This gives the claim. Repeatedly applying the claim we
have that for any a Vn,k and S {1, 2, . . . , n} with |S| even, there is a walk from a to
a(S). Using this, we know that those a with ni=1 ai even are in a same component C,
P
and those a with ni=1 ai odd are in a same component C 0 . Hence Gn,k has at most two
P
components.
For the case of n > k with k even, by definition, if a is adjacent to b then
Pn
i=1 bi
Pn
i=1
ai and
have the same parity. Consequently, C 6= C 0 . This gives that Gn.k has exactly 2
components.
k
z }| {
z }| {
n
k
is
P
ni 2i with each ni {0, 1} and k = ri=0 ki 2i with each
i=0
Qr ni
n
(mod
2).
In
other
words,
is odd if and only if
i=0 ki
k
Remark. Suppose n =
ki {0, 1}. Then,
Pr
ni = 0 implies ki = 0 for 0 i r.
1
(c) This is impossible for n = k or (n, k) = (2, 1), since Gn,n = 2n1 K2 and G2,1 = C4 .
We now assume that n > k and (n, k) 6= (2, 1). In this case, n 3 and 1 k n 1
implying
n
k
n
k
(check it).
We first claim that if m > r > 1 with mr even, then there is a connected rregular graph of m vertices. Let s = br/2c. Consider the graph Cm,r with vertex
set {v0 , v1 , . . . , vm1 } and edge set {vi vi+j : j = 1, 2, . . . , s} for even r (respectively,
{vi vi+j : j = 1, 2, . . . , s} {vi vi+m/2 : i = 0, 1, . . . , m/2 1} for odd r), where the indices
for the vertices are taken modulo m. It is easy to check that the graph so constructed is
connected and r-regular.
For the case of k is even, Gn,k has exactly two components. Then, C2n ,(n) is a conk
nected graph with the same degree sequence as Gn,k .
For the case of k is odd, Gn,k is connected. Then, 2C2n1 ,(n) is a graph of 2 components
k
n
k
> 1.
2. (20%) Suppose x1 , x2 , . . . , xn are n distinct numbers. The following method finds the
maximum of these n numbers using n 1 comparisons:
max = x1 ;
do i = 2 to n ;
if max < xi then max = xi ;
Similarly, we may find the minimum by using n 1 comparisons. Consequently, we may
find the maximum and the minimum by using totally 2n 2 comparisons.
Design an algorithm to find the maximum and the minimum by using less than
2n 2 comparisons. Is your method the best possible one?
Solution. Suppose we use fn comparisons to do the job. Clearly, f2 = 1 and f3 = 3 will
do the job. For n 4, we first use fn2 comparisons to find the max M 0 and the min m0
of the first n 2 numbers. We use 1 comparison to get the max M 00 and the min m00 of
2
the rest two numbers. Finally, compare M 0 and M 00 to get the max, and compare m0 and
m00 to get the min. So, fn = 3 + fn2 . In conclusion, fn = d3n/2e 2.
Reasons for this number of comparisons is the best possible: please refer to the book
Fundamentals of Computer Algorithms by Ellis Horowitz and Sartaj Sahni.
roots 2 3. So, tn = a(2 + 3)n + b(2 3)n . Using initial conditions t1 = 1 and t2 = 4
we get a = b = 2 3 and so tn = (2 + 3)n (2 3)n /2 3.