[algogeeks] Re: hi..plz solve this..

2006-07-06 Thread Googmeister
Arunachalam wrote: > Hi, > can you please elaborate on your question? > > If I understand you correct then you are given an array of Length 2n with > elements a1,a2...an,b1,b2.. bn. > > Now you are asked to modify the array to a1,b1,a2,b2.an,bn. > > If this is the problem then the soluti

[algogeeks] Re: hi..plz solve this..

2006-07-06 Thread Arunachalam
Hi,   for example consider this array a1,a2,a3,b1,b2,b3.   Now you start with a2 which is not in its place. Mark the second place as empty move a2 to its position. Before moving make a copy of a3 in memory. Now put a2 there.   So the array will look like a1,_,a2,b1,b2,b3. Now do the same thing

[algogeeks] Re: hi..plz solve this..

2006-07-06 Thread Arunachalam
Hi dude,    it has only one more element to be moved in the extra space. Other elements use the existing array as the space so space complexity is O(1) clearly.  On 7/6/06, Vishal <[EMAIL PROTECTED]> wrote: What about O(1) space complextity? I think your solution has space complexity of O(n). 

[algogeeks] Re: hi..plz solve this..

2006-07-06 Thread Siva
hi arunachalam i belv u got the question correct...but could u elaborate ur soln... it s too handwavy..i still dont know how it can be done in place... thanks siva --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

[algogeeks] Re: hi..plz solve this..

2006-07-06 Thread Vishal
What about O(1) space complextity? I think your solution has space complexity of O(n).~VishalOn 7/6/06, Arunachalam < [EMAIL PROTECTED]> wrote:Hi, can you please elaborate on your question?   If I understand you correct then you are given an array of Length 2n with elements a1,a2...an,b1,b2..

[algogeeks] Re: hi..plz solve this..

2006-07-06 Thread Arunachalam
Hi, can you please elaborate on your question?   If I understand you correct then you are given an array of Length 2n with elements a1,a2...an,b1,b2.. bn.   Now you are asked to modify the array to a1,b1,a2,b2.an,bn.   If this is the problem then the solution is straight forward. For each