public void cycleLeaderIteration(char []str,int start,int end){
        
        int power = 1;
        int index = start,new_index;
        int len = end -start +1;
        char temp,temp1;
        while(power < len){
            index = start+power;
            new_index = start;
            temp = str[index];
            while(new_index != power + start){
                if(index % 2 == 0){
                    new_index = (index+start)/2;
                }else{
                    new_index = len/2 + (index+start)/2;
                }
                temp1 = str[new_index];
                str[new_index] = temp;
                temp = temp1;
                index = new_index;
            }
            power *= 3;
        }
    }
http://www.geeksforgeeks.org/an-in-place-algorithm-for-string-transformation/
src/com/interview/string/InPlaceTransformationOfString.java