on optimal solutions for the bottleneck tower of hanoi problem yefim dinitz shay solomon dept. of...

74
On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

Upload: amya-rokes

Post on 29-Mar-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

On Optimal Solutions for the Bottleneck Tower of Hanoi Problem

Yefim Dinitz Shay SolomonDept. of Comp. Sci., Ben-Gurion University

ISRAEL

Page 2: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

Contents of the lecture

1. Background on the Tower of Hanoi.

2. The Bottleneck Tower of Hanoi (BTH) problem.

3. The family of all optimal solutions to BTH.

4. Investigation of the configuration graph of

BTH: its diameter and average distance.

Page 3: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

1. Background• The first version of the puzzle was marketed by Edouard

Lucas in 1883, under the name "Tower of Hanoi“:

- Given are 3 pegs, denoted by A,B and C, and n disks of distinct sizes placed on peg A in decreasing order, largest at the bottom to the smallest at the top.

- The goal of the puzzle is to transfer all disks to peg C, placed in the same order, by the minimum possible number of moves.

- The rules are to move a single disk from (the top of) one peg to (the top of) another one at each step, following the "divine rule": to never have a larger disk above a smaller one.

Page 4: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

1

2

n-1

n

A B C

Example for general nMove number

Page 5: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

1

2

n-1

A B C

The optimal transfer for general n

n

Move number

Cn-1

Page 6: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

1

2

n-1

A B C

n

Move number

Cn-1 + 1 The optimal transfer for general n

Page 7: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

1

2

n-1

n

A B C

Move number

2 Cn-1 + 1 The optimal transfer for general n

Page 8: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

The recurrence formula is

cn = 2cn-1 + 1, c1 = 1.

Hence, cn = 2^n -1.

This classical Tower of Hanoi problem with three pegs is a basic problem, taught as a basic example of a recursion program.

Page 9: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

There is a great proliferation of new ToH puzzles posed over the

last twenty years.

There is a bibliography made by Paul Stockmeyer, which covers over 350

papers on the subject.

Page 10: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

In 1981, D. Wood posed the following generalization of ToH, which we call the

“Bottleneck Tower of Hanoi Problem, BTHn= BTHn,k”,

depending on an integer parameter k, k>0.

2. The Bottleneck ToH problem

Page 11: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

The k-relaxed Placement Rule:

Besides the usual placement of smaller disks above bigger ones, a bigger disk j may be placed above a smaller disk i, if

their size difference j - i < k.

i+k

….

….

i

Page 12: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

• A placement of the n disks [1..n] on a single peg is called a tower of n disks.

• The decreasing bottom-top placement of the n disks [1..n] on a peg is called the perfect tower.

1

2

3

n-2

n-1

n

Definitions

Page 13: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

Description of BTHn:

• There are 3 pegs: A,B, and C.• The goal is to transfer the perfect tower on

peg A to the perfect tower on peg C.• The placement rule is k-relaxed.

(Note that if k=1, we arrive at the classical problem.)

Page 14: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

1

2

3

7

6

5

4

Example: k=4, n=7

Legal

We note that there are many legal towers for a given k.

As k grows, there are more legal towers.

(The two extreme) examples:k=1, one legal tower (perfect tower).k≥n, n! possible towers.

Page 15: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

• D.Poole [1992] suggested the sequence of moves αn (described in the next slide), which solves BTHn. He showed its optimality within just one simple strategy.

• Beneditkis, Berend, and Safro [1998] proved its optimality for the case k=2.

• We proved optimality of αn for the general case [ISAAC’2006].

• Remark: another proof of optimality of αn for BTHn, by different techniques, was suggested independently by Xiaomin Chen et al. (unpublished).

Page 16: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

αn(A,C) (not explicitly)

1.(*) Move disks [1..(n-1)] from A, by the minimum possible number of moves,

to any (legal) state on B.

2. Move disk n from A to C.

3.(*) Move disks [1..(n-1)] from B to the perfect tower on C, by the minimum possible number of moves.

Page 17: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

1234

….….….….….n-1

n

A C B

Page 18: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

[1..n-1]

n

A C B

Page 19: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

[1..n-1]

A C B

n

Page 20: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

n

A C B

1234

….….….….….n-1

Page 21: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

“Somehow” tower-move(*): To move a tower of m disks on one peg, to a tower of m disks on another peg, in any order.

• D. Poole and BBS used, for the “somehow” problem, the following optimal sequence of moves, βm:

Page 22: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

βm(source,target):(for the explanation, assume that the initial configuration is perfect)

• If m ≤ k, move all disks from source to target one by one.

• Otherwise:

1. Recursively perform βm-k(source,auxiliary).

2. Move k disks [(m-k+1)..m] one by one from source to target.

3. Recursively perform βm-k(auxiliary,target).

Page 23: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

1

2

3

4

5

6

7

K=4, m=7

source auxiliary target

Page 24: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

4

5

6

7

3

2

1

source auxiliary target

Page 25: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

3

2

1

source auxiliary target

7

6

5

4

Page 26: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

1

2

3

7

6

5

4

source auxiliary target

Page 27: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

1

2

3

4

5

6

7

8

9

10

11

K=4, m=11

source auxiliary target

Page 28: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

8

9

10

11

1

2

3

7

6

5

4

source auxiliary target

Page 29: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

11

10

9

8

1

2

3

7

6

5

4

source auxiliary target

Page 30: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

1

2

3

4

5

6

7

11

10

9

8

source auxiliary target

Page 31: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

(**) We remark that, if we start with the

perfect tower on A, and perform βm(A,B)

followed by βm(B,C), the result is the perfect tower on C.

Page 32: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

αn(A,C), reformulated

1. perform βn-1(A,B).

2. Move disk n from A to C.

3. perform βn-1(B,C).

By earlier remark (**), αn solves BTHn.

Page 33: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

1234

….….….….….n-1

n

A C B

Page 34: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

n

A C B

123

….….

n-k-1n-1….

n-k+1n-k

Page 35: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

A C B

123

….….

n-k-1n-1….

n-k+1n-k

n

Page 36: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

n

A C B

1234

….….….….….n-1

Page 37: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

Notation and numerical results• bm = The number of moves in βm

• an = The number of moves in αn

• bm = 2bm-k + k ; b1 = 1,…, bk = k.

bm = r (2^q) + k (2^q -1),

where m = qk +r.

• an = 2bn-1 + 1 ; a1 = 1.

an = r (2^(q+1)) + k (2^(q+1) -2) + 1,

where n-1=qk + r.

Page 38: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

3. Family of all optimal solutions to BTHn

We prove that, in any optimal solution to

BTHn, disk n makes only one move, from peg A to C.

Before that move, all disks 1,…,n-1 have been moved from peg A to peg B.

After that move, all disks 1,..,n-1 will move from peg B to peg C.

Page 39: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

Is αn the unique optimal solution?In the case k=1, the answer is yes (and is

well known): there exists a unique solution for the classical problem.

For the case k ≥ 2, the answer is No!

Let us see a different sequence of moves, of the same length as that of αn:

Page 40: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

1

2

3

4

5

6

7

8

9

10

Example n=10, k=3

A B C

Page 41: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

4

5

6

7

8

9

10

3

2

1

A B C

Page 42: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

7

8

9

10

6

5

4

3

2

1

A B C

Page 43: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

1

2

3

6

5

4

7

8

9

10

A B C

Page 44: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

9

8

7

1

2

3

6

5

410

A B C

Page 45: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

9

8

7

6

5

4

3

2

1

10

Until this point, the move-sequence is the same as

αn

A B C

Page 46: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

3

6

9

8

7

5

4

2

1

10

A B C

Page 47: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

2

5

3

6

9

8

7 4

1

10

A B C

Page 48: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

1

4

2

5

3

6

9

8

710

A B C

Page 49: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

1

4

2

5

3

6

9

8

710

A B C

Page 50: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

9

8

7

3

2

1

10

6

5

4

A B C

Page 51: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

9

8

7 10

1

2

3

6

5

4

A B C

Page 52: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

7

8

9

10

1

2

3

6

5

4

A B C

Page 53: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

7

8

9

10

6

5

4

3

2

1

A B C

Page 54: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

4

5

6

7

8

9

10

3

2

1

A B C

Page 55: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

1

2

3

4

5

6

7

8

9

10

A B C

Page 56: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

Tower-Move

• tower-move – A sequence of moves that transfers a tower on one peg to a tower on another peg.

• For example:

- αn is a shortest perfect-to-perfect tower-move of n disks.

- βm is a shortest “somehow” tower-move

of m disks.

Page 57: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

General structure of an optimal tower-move

• It should be similar to the structure of the (recursive) classic Tower of Hanoi solution, but the transfer unit is a block of k disks (as in the example).

• Main Proposition 1: The only possible change, in an optimal solution, may be to interleave the two upper blocks.

• Main Observation 2: The ways of interleaving, each time, are independent.

Page 58: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

How many optimal solutions exist?

• Any optimal solution (i.e., a shortest p.t.p. tower move of [1..n]) contains 2^(┌(n-1)/k┐-1) tower-moves of the union of the two upper blocks.

• For any such even-numbered tower-move, except for the last tower-move, its final configuration can be chosen arbitrarily from a certain set (**) of C(k+r,k)-C(k+r,k+1) configurations.

• These are the only choices, for an optimal solution.

Page 59: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

An auxiliary problem equivalent to (**): Let n ≤ t+p.What is the number of integer solutions that satisfy the two following conditions:

• ∑xi =n, i=[0..t], xi≥0.

• ∑xi ≤ j+p, 0≤j ≤n-p, i=[0..j].

How many such configurations exist?

Page 60: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

The number of different solutions to (**) is:

C(n+t,t) – C(n+t,t+p+1)

Page 61: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

The number of all optimal solutions to BTHn is:

k ≥ 2:

(C(k+r,k)-C(k+r,k+1))^[┌2^(┌(n-1)/k┐-2)┐ -1],

where r= (n-1) mod k.

k=1:

A unique optimal solution

Page 62: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

4.1 Diameter of the configuration graph

Questions :

1. Find a pair of disk arrangements over A,B and C, requiring the longest sequence of moves in order to get from one to the other.

2. Find the length of that sequence (later referred as “diameter”).

Let us translate these questions to the language of graphs:

Page 63: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

• For BTHn , the corresponding configuration graph, G=(V,E) is the (undirected) graph s.t.:

• V is the set of all legal arrangements of the n disks over A, B and C.

• E = {e=(u,v)| u,v in V, s.t. u and v are reachable one from the other by a single move}.

Page 64: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

The configuration graph for the case n=2,k=2

(2,1),(),()

(2),(1),()

(2),(),(1)

(),(1,2),()

(),(1),(2)

(),(),(2,1)

(1),(),(2)

(),(),(1,2)

(1,2),(),()

(),(2),(1)

(),(2,1),()

(1),(2),()

Page 65: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

The diameter is 4

(2,1),(),()

(2),(1),()

(2),(),(1)

(),(1,2),()

(),(1),(2)

(),(),(2,1)

(1),(),(2)

(),(),(1,2)

(1,2),(),()

(),(2),(1)

(),(2,1),()

(1),(2),()

Page 66: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

We found the answer for the second question, i.e. the diameter, D(n,k),up to a constant factor.

D(n,k) = Θ((k^2)∙2^(n/k))

This is k times the shortest length of

a perfect-to-perfect tower-move. Reminder: an = Θ(k ∙2^(n/k))

Page 67: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

Tighter bounds for D(n,k):

• Let n ≤ k D(n,k) = Θ(n∙logn).

• Let k ≤ n ≤ 2k D(n,k) = Θ(n∙logn + (n-k)^2).

• For n>2k: D(n,k) = Θ((k^2)∙2^(n/k)).

Page 68: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

We believe (based on similar open questions raised by D. Knuth) that both afore-mentioned questions:

1. Finding a pair of disk arrangements requiring a longest sequence of moves.

2. Finding the length of that sequence (i.e, the previously mentioned diameter) exactly.

should be difficult even for the (degenerate) case n≤k.

Page 69: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

4.2 Average distance

We find the average number of moves required to get from one configuration to another, taken over all pairs of configurations, up to a constant factor.

In other words, we bound the average distance between nodes in the configuration graph of BTHn.

Page 70: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

We prove that the average, Avg(n,k), is asymptotically the same as the afore-mentioned diameter.

For n ≥ 3k:

Avg(n,k) = Θ(D(n,k)) = Θ((k^2)∙2^(n/k))

This is k times the shortest length of a

p.t.p. tower-move.

Page 71: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

Avg(n,k) for some values of n vs. k:

• Let n ≤ k:

Avg(n,k) = Θ(D(n,k)) = Θ(nlogn).

• For n>3k:

Avg(n,k) = Θ(D(n,k)) = Θ((k^2)∙2^(n/k)).

Page 72: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

In our paper at ISAAC’06, we considered optimal algorithms for ToH problems with generalized placement rules.

We appreciate your attention.

Page 73: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

The way of proof (for diameter)

Upper bound: We show an explicit way to transfer any tower of n disks in O((k^2)∙2^(n/k)) moves.

Page 74: On Optimal Solutions for the Bottleneck Tower of Hanoi Problem Yefim Dinitz Shay Solomon Dept. of Comp. Sci., Ben-Gurion University ISRAEL

Lower bound• Observation. When any disk out of the k biggest

disks [(n-k+1)..n] moves, all n-2k disks in [1..(n-2k)] should be on the spare peg.

• We show two configurations of the k biggest disks, such that any tower-move between them requires Ω(k) changes of the spare peg.

• As a consequence, for those configurations and the case n>2k, Ω(k) tower-moves of the n-2k smallest disks are required.

As we know, each one of those tower-moves requires Ω(k∙2^((n-2k)/k)) moves.