forget abt stable sort, your code wud not even do simple sort.
e.g. try your code on a[]={0,1,0} , it doesn't sort it as a[j] never > a[i].
cheers,
siva.
On 5/5/06, Cool_Happy <[EMAIL PROTECTED]> wrote:
i think this sort the array in linear time..
if this snippet has any error do let me know..
void sort(int *a)
{
for(int i = 1, j = 0; i<a.length;i++)
{
if(a[j] > a[i])
{
swap(a[i],a[j]);
j++;
}
}
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
