hi matia ... i think the code you have written sounds good.. but it is not sorting the array it is a kind of counting number of 1 and 0... how ever you can write a simple code like....
int one =0; zero =0; for (i=0;i<array_length;i++) { if(arr[i]) one++; else zero++; } for (i=0;i<zero;i++) print('0'); for (i=0;i<one;i++) print('1'); it would take same amount of memory as u explained.. but the given array remains unaffected.... so this code is just for printing purpose ... i think we hv to sort array so that we can use the sorted array ... If i am wrong then let me know... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---