I solved it without any temp variables and the solution works like magic.
Suppose the sequence is A1, A2, A3, A4, A5 B1, B2, B3, B4, B5
Now here N = 5. I had to perform 1+2+3+4 = N(N-1)/2 swaps to get the
desired order.
The scheme work like this.
At step 1, perform only one Swap - A5, B1
Now
@navneet
If you want to make it in O(n^2) simple scheme like insertion sort works
well and very simple!
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
@Sanket: Don't know, it works fine on my side...
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/6E5jS41APUMJ.
To post to this group, send email to
Here it is: http://arxiv.org/PS_cache/arxiv/pdf/0805/0805.1598v1.pdf
On Jun 27, 5:02 am, Ankit Sablok ankitsablok19091...@gmail.com
wrote:
Need a Better Algorithm
here is a trivial question we are given an array of 2n elements in the
form
{a1,a2,a3,..,an,b1,b2,b3b...bn}
we need to
@Juver - I am getting Access denied for the pdf link you sent :(
On Jun 27, 8:48 am, juver++ avpostni...@gmail.com wrote:
Here it is:http://arxiv.org/PS_cache/arxiv/pdf/0805/0805.1598v1.pdf
On Jun 27, 5:02 am, Ankit Sablok ankitsablok19091...@gmail.com
wrote:
Need a Better Algorithm