跳到主要内容

京都大学 情報学研究科 知能情報学専攻 2024年8月実施 情報学基礎 F2-1

Author

itsuitsuki

Description

大学公表の原題

Q.1

Let S=(3,1,2,4,5,1,3,3,4,2,1,2)S = (3, -1, 2, -4, 5, -1, 3, -3, 4, -2, 1, -2) be a number sequence of length 12 and s(i)s(i) is the value of the ii-th element of SS. For example, s(1)=3s(1) = 3 holds. Let us define maxSum(i,j)=maxiabjk=abs(k)\text{maxSum}(i, j) = \max_{i \leq a \leq b \leq j} \sum_{k=a}^{b} s(k) and M=maxSum(1,12)M = \text{maxSum}(1, 12).

(1) Derive the value of maxSum(1,4)\text{maxSum}(1, 4).

(2) Derive MM and all the values of (a,b)(a, b) that satisfy k=abs(k)=M\sum_{k=a}^{b} s(k) = M.

(3) Derive all the values of (a,b)(a, b) that satisfy k=abs(k)=M1\sum_{k=a}^{b} s(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)G_1(V_1, E_1) be an undirected graph with V1={v0,v1}V_1 = \{v_0, v_1\} and E1={{v0,v1}}E_1 = \{\{v_0, v_1\}\};

for i=2i = 2 to nn do

begin

    let viv_i be a new vertex;

    let vjv_j and vkv_k be distinct vertices randomly selected from Vi1V_{i-1};

    let Gi(Vi,Ei)G_i(V_i, E_i) be an undirected graph with Vi=Vi1{vi}V_i = V_{i-1} \cup \{v_i\} and

        Ei=Ei1{{vi,vj},{vi,vk}}E_i = E_{i-1} \cup \{\{v_i, v_j\}, \{v_i, v_k\}\};

end

Note that for any pair of distinct vertices (vj,vk)(v_j, v_k), the selection probability is positive. Obviously, any graph Gn(Vn,En)G_n(V_n, E_n) constructed by this algorithm is connected, has n+1n+1 vertices, and does not contain a self-loop or a multi-edge. In the following, we use GnG_n to denote Gn(Vn,En)G_n(V_n, E_n).

For a graph GnG_n, degGn(vp)\deg_{G_n}(v_p) denotes the degree of a vertex vpVnv_p \in V_n (i.e., the number of edges connecting to vpv_p), and distGn(vp,vq)\text{dist}_{G_n}(v_p, v_q) 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 vpv_p and vqv_q in VnV_n. Note that degGn(vp)\deg_{G_n}(v_p) and distGn(vp,vq)\text{dist}_{G_n}(v_p, v_q) are positive integers depending on randomly selected vertices in the algorithm.

In the following, nn is an even number greater than or equal to 4. Let Gn\mathcal{G}_n be the set of all possible undirected graphs GnG_n generated by this algorithm. For example, for any nn, minGnGn{ minvpVn{degGn(vp)} }=2\min_{G_n \in \mathcal{G}_n} \{~ \min_{v_p \in V_n} \{\deg_{G_n}(v_p)\} ~\} = 2 and maxGnGn{ minvpVn{degGn(vp)} }=2\max_{G_n \in \mathcal{G}_n} \{~ \min_{v_p \in V_n} \{\deg_{G_n}(v_p)\} ~\} = 2 hold because degGn(vn)=2\deg_{G_n}(v_n) = 2 always holds and degGn(vp)2\deg_{G_n}(v_p) \geq 2 always holds for any vertex vpVnv_p \in V_n.

Derive the following values. Note that the values may be given as mathematical expressions of nn.

(1) maxGnGn{ maxvpVn{degGn(vp)} }\max_{G_n \in \mathcal{G}_n} \{ ~\max_{v_p \in V_n} \{\deg_{G_n}(v_p)\}~ \}

(2) minGnGn{ maxp<q,vpVn,vqVn{distGn(vp,vq)} }\min_{G_n \in \mathcal{G}_n} \{~ \max_{p < q, v_p \in V_n, v_q \in V_n} \{\text{dist}_{G_n}(v_p, v_q)\} ~\}

(3) maxGnGn{ maxp<q,vpVn,vqVn{distGn(vp,vq)} }\max_{G_n \in \mathcal{G}_n} \{~ \max_{p < q, v_p \in V_n, v_q \in V_n} \{\text{dist}_{G_n}(v_p, v_q)\} ~\}

题目描述

  1. S=(3,1,2,4,5,1,3,3,4,2,1,2)S=(3,-1,2,-4,5,-1,3,-3,4,-2,1,-2),并定义
    maxSum(i,j)=maxiabjk=abs(k),M=maxSum(1,12).\operatorname{maxSum}(i,j)= \max_{i\le a\le b\le j}\sum_{k=a}^b s(k),\qquad M=\operatorname{maxSum}(1,12).
    maxSum(1,4)\operatorname{maxSum}(1,4);求 MM 及全部使区间和为 MM(a,b)(a,b);再求全部使区间和为 M1M-1(a,b)(a,b)
  2. 随机图算法从边 {v0,v1}\{v_0,v_1\} 开始。对 i=2,,ni=2,\ldots,n,新建 viv_i,从已有顶点中随机选不同的 vj,vkv_j,v_k,加入边 {vi,vj},{vi,vk}\{v_i,v_j\},\{v_i,v_k\}。设 n4n\ge4 为偶数,Gn\mathcal G_n 为所有可能输出。求:
    1. 所有图中最大可能顶点度;
    2. 所有图中最小可能直径;
    3. 所有图中最大可能直径。 答案可写成 nn 的表达式。

Kai

Q.1

Let p0=0p_0=0 and pj=k=1js(k)p_j=\sum_{k=1}^j s(k). The complete prefix-sum list is

(p0,p1,,p12)=(0,3,2,4,0,5,4,7,4,8,6,7,5).(p_0,p_1,\ldots,p_{12})=(0,3,2,4,0,5,4,7,4,8,6,7,5).

Every interval sum is pbpa1p_b-p_{a-1}, with a1<ba-1<b.

(1) Among the first four elements, the maximum is 44, attained by (a,b)=(1,3)(a,b)=(1,3).

(2) The largest difference of a prefix sum and an earlier prefix sum is M=8M=8. The complete set of maximizing intervals is

(a,b)=(1,9), (5,9).(a,b)=(1,9),\ (5,9).

(3) Reading all ordered pairs of prefix sums whose difference is 77 gives exactly

(a,b)=(1,7), (1,11), (5,7), (5,11).(a,b)=(1,7),\ (1,11),\ (5,7),\ (5,11).

Q.2

(1)

There are n+1n+1 vertices, so every degree is at most nn. Choose v0,v1v_0,v_1 as the two neighbors of every new vertex. Then v0v_0 has degree nn, proving that the answer is nn.

(2)

The same construction has diameter 22: any two new vertices share v0v_0 as a neighbor. A diameter of 11 would require a complete graph, but every generated graph has

En=1+2(n1)=2n1<n(n+1)2(n4).|E_n|=1+2(n-1)=2n-1<\frac{n(n+1)}2\qquad(n\ge4).

Thus the minimum diameter is 22.

(3)

Every generated graph with at least three vertices remains connected after deleting any one vertex. This holds for the initial triangle. Inductively, a new vertex has two distinct neighbors, so deleting one old vertex leaves it joined to the remaining connected old graph; deleting the new vertex simply restores the old graph.

Let u,vu,v have distance dd, and group vertices by their distance from uu. Each layer 1,,d11,\ldots,d-1 contains at least two vertices: a singleton layer would disconnect uu from vv when its sole vertex was deleted, since an edge changes distance from uu by at most one. Counting the endpoints and intermediate layers gives

n+11+2(d1)+1=2d.n+1\ge1+2(d-1)+1=2d.

Because nn is even, dn/2d\le n/2.

To attain this bound, connect each viv_i to vi1v_{i-1} and vi2v_{i-2}. Every edge changes the index by at most two, and the path v0,v2,,vnv_0,v_2,\ldots,v_n has length n/2n/2. Hence the maximum diameter is n/2n/2.