PA of Algorithms Q64

0. The recurrence relation capturing the optimal execution time of the Towers of Hanoi problem with n discs is

  • Option : D
  • Explanation :
    Let the three pegs be A,B and C, the goal is to move n pegs from A to C using peg B The following sequence of steps are executed recursively
    1. move n – 1 discs from A to B. This leaves disc n alone on peg A ..... T(n – 1)
    2. move disc n from A to C ..... 1
    3. move n – 1 discs from B to C so they sit on disc n T(n – 1)
    So, T(n) = 2T(n – 1) + 1
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *