void sort(int arr[])
{
    for(int i = 0, j = 0; i<arr.length ;j++)
    if(arr[j])
    {
        arr[i]=1;
        arr[j]=0;
         i++;
    }
}

This should work, the only think I doubt is whether it qualifies as a
single pass or not, coz i have two variables i,j in the for loop.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to