Hi all,

This is c code for the orginal problem.. I is working fine!

fuction(int a[], int N){
 int swaps=0, i;
 for(i=1;(i < N/2) && (swaps < N-2); i+=2)
 {
    int p=i, temp=a[i], inside=0, t;
    while(p!=i || ! inside){
      inside=1;
      p= (p >= N/2) ? 2*p-N+1 : 2*p;
      t=a[p]; a[p]=temp; temp=t;
      swaps++;
    }
 }
}
Thaks,
Kamlesh


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to