GATE CSE
First time here? Checkout the FAQ!
x
+5 votes
191 views
In the tower of Hanoi $x , y , z$ are the positions and we are to move 10 disks from $x$ to $y$. What are the $128$th and $768$th moves ?

(A) $x\rightarrow y$ and $x\rightarrow z$

(B) $x\rightarrow z$ and $z\rightarrow x$

(C) $x\rightarrow z$ and $z\rightarrow y$

(D) $x\rightarrow y$ and $z\rightarrow y$
asked in DS by Veteran (45.6k points)  
edited by | 191 views
just 4 level + 2 level traverse
what is the answer?
it should be $X$ to $Y$ ( for $128$th move)   and $Z$ to $Y$ ( for $768$th move).
......

1 Answer

+6 votes
Best answer

H(n,x,y,z) means currently we have 10 disks on x and we need to move all of them from x to y using z. 

$H(n,x,y,z) \text{ needs } (2^{n} - 1) \text{ moves using recursion}$

answered by Veteran (45.6k points)  
selected by


Top Users Apr 2017
  1. akash.dinkar12

    3508 Points

  2. Divya Bharti

    2542 Points

  3. Deepthi_ts

    2040 Points

  4. rude

    1966 Points

  5. Tesla!

    1768 Points

  6. Shubham Sharma 2

    1610 Points

  7. Debashish Deka

    1588 Points

  8. Arunav Khare

    1454 Points

  9. Kapil

    1424 Points

  10. Arjun

    1420 Points

Monthly Topper: Rs. 500 gift card

22,076 questions
28,040 answers
63,230 comments
24,135 users