• 検索結果がありません。

(1) 本問を選択

N/A
N/A
Protected

Academic year: 2021

シェア "(1) 本問を選択"

Copied!
1
0
0

読み込み中.... (全文を見る)

全文

(1)

アルゴリズム (1)

本問を選択(Select this problem){ する(Yes),しない(No) } No.

ハノイの塔の問題を解く再帰的手続きH1(n, A, B, C)を次に与える.3本の杭A, B, Cがこの順番で一列に並 んでおり,n枚の大きさの異なる円盤がある.円盤の中心に穴があいており,穴を杭に通しながら円盤を積み 上げていく.ただし,大きい円盤の上に小さい円盤を置かなければならない.始めn枚の円盤がA に積み上 げられている時,これらの円盤を全てCに積み上げたい.円盤は一度に一枚しか移動できないとする.

We give a recursive procedure H1(n, A, B, C) for the Towers of Hanoi problem in the following. We have three pegs A, B, C arranged in a row and in this order, and n disks initially stacked in increasing size on peg A. The objective is to transfer the entire tower from pegA to peg C, subjected to the condition that only one disk should be moved at a time and no disk be placed above a smaller.

procedure H1(n, A, B, C);

if n≥1 then begin H1(n−1, A, C, B);

“move fromA toC”;

H1(n−1, B, A, C) end

(1) 手続きH1(4, A, B, C)では,円盤を合計何回移動しているか説明しなさい.

Explain how many moves in the procedure H1(4, A, B, C).

(2) H1(n, A, B, C)での円盤の移動回数をT1(n)と書く.ここで,T1(n)に関する再帰方程式を与えてその解 を求めよ.ただし,T1(0) = 0とする.

Let T1(n) be the number of moves in the procedureH1(n, A, B, C) whereT1(0) = 0. Give a recursive equation for T1(n) and solve it.

(3) 問題の条件としてさらに,隣接している杭の間だけで円盤は移動できるものとする.この問題を解く手 続きH2(n, A, B, C)を与えよ.

We impose the extra condition that a disk must be transferred only between adjacent pegs. Then give a recursive procedureH2(n, A, B, C) to solve this problem.

(4) H2(n, A, B, C)での円盤の移動回数T2(n)を求めよ.ただし,T2(0) = 0とする.

Give T2(n), i.e., the number of moves in the procedureH2(n, A, B, C) whereT2(0) = 0.

(解答は裏面を使用しても構わない.You can use the reverse side of this paper for your answering.)

参照

関連したドキュメント

Once bulk deformation b is chosen (so that there is a torus fiber L whose Floer cohomology is non-vanishing), then we consider the Floer chain complex of L with a generic torus fiber

Next, let us observe that it follows from Lemma 2.4 and [1], Proposition 3.2, that the zero divisor of the square Hasse invariant of this nilpotent indigenous bundle coincides with

In § 6, we give, by applying the results obtained in the present paper, a complete list of nilpotent/nilpotent admissible/nilpotent ordinary indigenous bundles over a projective

In particular, we show that the strong convergence implies the weak convergence and disprove the converse through a counter-example, by invoking an analogue of Parseval’s identity

In this note, we consider a second order multivalued iterative equation, and the result on decreasing solutions is given.. Equation (1) has been studied extensively on the

In [7], assuming the well- distributed points to be arranged as in a periodic sphere packing [10, pp.25], we have obtained the minimum energy condition in a one-dimensional case;

I The bijection sending the area to the sum of the major and the inverse major index can be generalized to types B and C but fails to exist in type D... Non-crossing and non-nesting

[7] Martin K¨ onenberg, Oliver Matte, and Edgardo Stockmeyer, Existence of ground states of hydrogen-like atoms in relativistic quantum electrodynam- ics I: The