@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.

Reply via email to