京都大学 情報学研究科 知能情報学専攻 2024年8月実施 情報学基礎 F2-1
Author
itsuitsuki
Description (English)
Q.1
Let S=(3,−1,2,−4,5,−1,3,−3,4,−2,1,−2) be a number sequence of length 12 and s(i) is the value of the i-th element of S. For example, s(1)=3 holds. Let us define maxSum(i,j)=maxi≤a≤b≤j∑k=abs(k) and M=maxSum(1,12).
(1) Derive the value of maxSum(1,4).
(2) Derive M and all the values of (a,b) that satisfy ∑k=abs(k)=M.
(3) Derive all the values of (a,b) that satisfy ∑k=abs(k)=M−1.
Q.2
Consider an algorithm for generating an undirected graph using random numbers, whose pseudocode is given below.
let G1(V1,E1) be an undirected graph with V1={v0,v1} and E1={{v0,v1}};
for i=2 to n do
begin
let vi be a new vertex;
let vj and vk be distinct vertices randomly selected from Vi−1;
let Gi(Vi,Ei) be an undirected graph with Vi=Vi−1∪{vi} and
Ei=Ei−1∪{{vi,vj},{vi,vk}};
end
Note that for any pair of distinct vertices (vj,vk), the selection probability is positive. Obviously, any graph Gn(Vn,En) constructed by this algorithm is connected, has n+1 vertices, and does not contain a self-loop or a multi-edge. In the following, we use Gn to denote Gn(Vn,En).
For a graph Gn, degGn(vp) denotes the degree of a vertex vp∈Vn (i.e., the number of edges connecting to vp), and distGn(vp,vq) denotes the length (i.e., the number of edges) of the shortest path (i.e., the path consisting of the minimum number of edges) between two distinct vertices vp and vq in Vn. Note that degGn(vp) and distGn(vp,vq) are positive integers depending on randomly selected vertices in the algorithm.
In the following, n is an even number greater than or equal to 4. Let Gn be the set of all possible undirected graphs Gn generated by this algorithm. For example, for any n,
minGn∈Gn{ minvp∈Vn{degGn(vp)} }=2 and maxGn∈Gn{ minvp∈Vn{degGn(vp)} }=2 hold because degGn(vn)=2 always holds and degGn(vp)≥2 always holds for any vertex vp∈Vn.
Derive the following values. Note that the values may be given as mathematical expressions of n.
(1) maxGn∈Gn{ maxvp∈Vn{degGn(vp)} }
(2) minGn∈Gn{ maxp<q,vp∈Vn,vq∈Vn{distGn(vp,vq)} }
(3) maxGn∈Gn{ maxp<q,vp∈Vn,vq∈Vn{distGn(vp,vq)} }