when we get a different bit from the previous one, four condition arises
defining position of the bit :
consider this bit form : 10011111 (from left, 1 is at odd position, then 0
at even, then next 0 at odd, and so on)
now four conditions are(except for 1st bit because it has no previous bit) :
1. previous bit is 1 and current bit is 0 and previous bit
is at odd position
then move disk to right of current position of that disk
2. previous bit is 1 and current bit is 0 and previous bit
is at even position
then move disk to left of current position of that disk
3. previous bit is 0 and current bit is 1 and previous bit
is at odd position
then move disk to left of current position of that disk
4. previous bit is 0 and current bit is 1 and previous bit
is at even position
then move disk to left of current position of that disk
for first bit if it is zero means biggest disk is at initial position else
at final position.
you try it for 3 disk
write binary form 000 (initial position) to 111(final position)
make the moves and try to figure out.
You will definately come to this result
best of luck
--
Regards
Jitendra Kushwaha
MNNIT, Allahabad
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.