Errata: Should be j in place of i in the condition statement of the for loop. and arr[j]=0 should come before arr[i]=0;
Here's the correct code. void sort(int arr[]) { for(int i = 0, j = 0; j<arr.length ;j++) if(arr[j]) { arr[j]=0; arr[i]=1; i++; } } --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---