yes it is same and it not working . Apart for this you had provided code for sorting O(n) time and not the idea/algo. please explain the algorithm , how you are sorting it within O(n) time and O(1) space complexity.
On Mon, Jul 2, 2012 at 3:18 PM, Amol Sharma <[email protected]> wrote: > i don't see any change in the code you posted...other than expanding swap > function.... > > i believe in discussing the idea/algo....not the code.. > > -- > > > Amol Sharma > Final Year Student > Computer Science and Engineering > MNNIT Allahabad > > <http://gplus.to/amolsharma99> > <http://twitter.com/amolsharma99><http://in.linkedin.com/pub/amol-sharma/21/79b/507><http://www.simplyamol.blogspot.com/><http://facebook.com/amolsharma99> > > > > > > > On Mon, Jul 2, 2012 at 12:59 PM, atul anand <[email protected]>wrote: > >> @amol : >> >> #include<stdio.h> >> >> int main() >> { >> >> int arr[]={5,0,1,2,6,7,8,3,4,9}; >> int i,j,n,temp; >> n=sizeof(arr)/sizeof(arr[0]); >> >> for(j=0;j<=1;j++) >> { >> for(i=0;i<n;i++) >> { >> if(arr[i]!=i){ >> temp=arr[i]; >> arr[i]=arr[arr[i]]; >> arr[arr[i]]=temp; >> >> } >> >> } >> } >> >> for(i=0;i<n;i++) >> printf("%d ",arr[i]); >> printf("\n"); >> return 1; >> >> } >> >> >> >> -- >> 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?hl=en. >> > > -- > 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?hl=en. > -- 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?hl=en.
