Skip to content

[Oops.] Error in RULERHANOI Algorithm in Exercise 1.1(d) #312

Description

@skydiving94

Please verify that the error is present in the most recent revision before reporting.

Chapter number or note title: Ex 1.1(d)

Page number: 45

Error description:
The RULERHANOI(n = 1) algorithm produces the move 1: 0→1 as its first step.

  • i = 1
  • \rho(1) = 1 as 1/2 is not integer.
  • 1 \leq n
  • n - 1 = 1 - 1 = 0 is even
  • moves disk from 0 to 1.

This contradicts the correct first move of 1: 0→2.

  • R(1, 0, 2, 1) skips the first and second recursive calls and moves disk from 0 to 2 directly.

Since the algorithm fails on this simple case, it is not a correct general solution for the Tower of Hanoi problem.

Suggested fix (if any):

  • Unverified, but perhaps switch the forward/backward? i.e. n - i being even means moving backward?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions