Re: [algogeeks] towers of hanoi O(1) time

2010-06-17 Thread Jitendra Kushwaha
when we get a different bit from the previous one, four condition arises defining position of the bit : consider this bit form : 1001 (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) :

Re: [algogeeks] Towers of hanoi

2010-06-17 Thread ANUJ KUMAR
i am not getting what to do when we get a different bit from the previous one someone please explain On Mon, Jun 14, 2010 at 9:14 AM, Anurag Sharma wrote: > Use iterative version :http://en.wikipedia.org/wiki/Tower_of_Hanoi > > Anurag Sharma > > On Mon, Jun 14, 2010 at 12:36 AM, ANUJ KUMAR > wr

[algogeeks] towers of hanoi

2010-06-17 Thread ANUJ KUMAR
please post the solution to http://www.spoj.pl/problems/HAN01/ -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr.

Re: [algogeeks] towers of hanoi O(1) time

2010-06-17 Thread Anand
@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 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 ar

Re: [algogeeks] towers of hanoi O(1) time

2010-06-16 Thread ANUJ KUMAR
please explain what happens when we get a different bit from the previous one. On Wed, Jun 16, 2010 at 4:53 PM, ANUJ KUMAR wrote: > I am not getting how you place a move when you get a bit that is > different from previous one > > > # A bit with a different value to the previous one means that th

Re: [algogeeks] towers of hanoi O(1) time

2010-06-16 Thread ANUJ KUMAR
I am not getting how you place a move when you get a bit that is different from previous one # A bit with a different value to the previous one means that the corresponding disk is one position to the left or right of the previous one. Whether it is left or right is determined by this rule:

Re: [algogeeks] towers of hanoi O(1) time

2010-06-15 Thread Jitendra Kushwaha
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

Re: [algogeeks] Towers of hanoi

2010-06-15 Thread Jitendra Kushwaha
Even your own stack will give TLE :) Try solving this question with binary solution of tower of hanoi and you will definately pass the time limit. -- Regards Jitendra Kushwaha MNNIT, Allahabad -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group.

[algogeeks] towers of hanoi O(1) time

2010-06-15 Thread ANUJ KUMAR
how can we print the reconstructed configuration of the towers after k steps in towers of hanoi problem in O(1) time. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscr

Re: [algogeeks] Towers of hanoi

2010-06-15 Thread Anurag Sharma
Use iterative version :http://en.wikipedia.org/wiki/Tower_of_Hanoi Anurag Sharma On Mon, Jun 14, 2010 at 12:36 AM, ANUJ KUMAR wrote: > http://www.spoj.pl/problems/HAN01/ > i implemented it using stack but am getting tle someone please help > > -- > You received this message because you are subsc

[algogeeks] Towers of hanoi

2010-06-13 Thread ANUJ KUMAR
http://www.spoj.pl/problems/HAN01/ i implemented it using stack but am getting tle someone please help -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this g