@Jitendra: Could not understand in which peg the plates should be. Can you please let us know
On Tue, Jun 15, 2010 at 9:12 AM, Jitendra Kushwaha <[email protected] > wrote: > Dear Anuj, > > Its easy to do. > lets take an example > say we have 4 disks. We will require 2^4-1 = 15 steps to solve it. > Now suppose we are at 6th step.. > write it binary form using 4 bits(since we have 4 disks) 0110 > now from left 0 means 4th disk is on initial peg > second bit 1 means disk 3 is on left of the previous disk > third bit 1 means it is above previous disk > fourth bit 0 means it is on right of previuos disk > > so the solution is something like > 1: 4|1 > 2: > 3: 3|2 > > 1: is initial peg (left of 1 means 3 and right means 2) > 2: is final peg > > hope it is clear how to solve this in O(no_of_disk) complexity > you can refer this link : > http://britton.disted.camosun.bc.ca/jbhanoi.htm > <http://britton.disted.camosun.bc.ca/jbhanoi.htm> > > > comment for any related doubts :) > > -- > 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]<algogeeks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- 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.
