This is in Java

==

public class Permute {
        public static void main(String[] args) {
                permute("", "ABCD");
        }

        public static void permute(String parent, String s) {
                if (s.length() == 2) {
                        System.out.println(parent + s);
                        System.out.println(parent + s.charAt(1) +
s.charAt(0));
                } else
                        for (int i = 0; i < s.length(); i ++)
                                permute(parent+s.charAt(i),
s.substring(0, i)+s.substring(i+1));
        }

}


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

Reply via email to