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