try merging this array
[{5,9,10},{3,6,7,9}]...
On Wed, Jul 14, 2010 at 9:30 AM, Ashish Goel ashg...@gmail.com wrote:
int dstart = -1;
int dend = -1;
int istart=-1; int iend = -1;
bool decreasing = false;
for (int i=1;in;i++)
{
if (a[i] =a[i-1])
{ if (decreasing)
{
dend
good one
shifting array is the solution but i want to do it without shifting, is
there a solution!!!
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652
On Thu, Jul 15, 2010 at 4:26 AM, jalaj jaiswal jalaj.jaiswa...@gmail.comwrote:
try merging this
int dstart = -1;
int dend = -1;
int istart=-1; int iend = -1;
bool decreasing = false;
for (int i=1;in;i++)
{
if (a[i] =a[i-1])
{ if (decreasing)
{
dend =i-1; istart=i;
reverse (a, dstart, dend);
merge(a,0,dstart-1, dstart, dend); ///merge 0, dstart-1 array with
array
This is a good solution.
Reversing the arrays will be O(n)
Then merging will be O(n) too.
In place merge is something like this.
Have two indices as start1 and start2
start1 points to beginning of mini-sorted portion1
start2 points to beginning of mini-sorted portion2
Increase both start1 and
@ above can u please be more specific
let A[1,9,10] and B [2,4,6]
Now how to swap so that the complexity remains O(n)
-- Forwarded message --
From: Tech Id tech.login@gmail.com
Date: Mon, Jul 12, 2010 at 8:18 PM
Subject: [algogeeks] Re: sort in O(n)
To: Algorithm Geeks
how to swap so that the complexity remains O(n)
-- Forwarded message --
From: Tech Id tech.login@gmail.com
Date: Mon, Jul 12, 2010 at 8:18 PM
Subject: [algogeeks] Re: sort in O(n)
To: Algorithm Geeks algogeeks@googlegroups.com
This is a good solution.
Reversing
:18 PM
Subject: [algogeeks] Re: sort in O(n)
To: Algorithm Geeks algogeeks@googlegroups.com
This is a good solution.
Reversing the arrays will be O(n)
Then merging will be O(n) too.
In place merge is something like this.
Have two indices as start1 and start2
start1 points to beginning
...@gmail.comwrote:
@ above can u please be more specific
let A[1,9,10] and B [2,4,6]
Now how to swap so that the complexity remains O(n)
-- Forwarded message --
From: Tech Id tech.login@gmail.com
Date: Mon, Jul 12, 2010 at 8:18 PM
Subject: [algogeeks] Re: sort in O(n
] Re: sort in O(n)
To: Algorithm Geeks algogeeks@googlegroups.com
This is a good solution.
Reversing the arrays will be O(n)
Then merging will be O(n) too.
In place merge is something like this.
Have two indices as start1 and start2
start1 points to beginning of mini-sorted portion1
start2
On Jul 12, 10:48 am, Tech Id tech.login@gmail.com wrote:
This is a good solution.
Reversing the arrays will be O(n)
Then merging will be O(n) too.
In place merge is something like this.
Have two indices as start1 and start2
start1 points to beginning of mini-sorted portion1
start2
I searched Google for it but no luck.
Texts have made references to k-tonic sort but couldn't find
definition.
--
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
11 matches
Mail list logo