search for: getpermut

Displaying 1 result from an estimated 1 matches for "getpermut".

Did you mean: testpermut
2008 Apr 06
3
Multiset Permutations
...ing np = new String(p); char[] ns = new char[s.length-1]; int y = 0; for(int z=0; z<s.length; z++){ if(z != x) ns[y++] = s[z]; } np = np + s[x]; if(ns.length == 0) perms.put(np, new Boolean(true)); else PermutationsRecursive(ns, np, perms); } } public static String[] GetPermutations(char[] in){ int fact = Factorial(in.length); Hashtable perms = new Hashtable(fact); PermutationsRecursive(in, "", perms); Enumeration e = perms.keys(); String[] out = new String[perms.size()]; int i = 0; while(e.hasMoreElements()){ out[i++] = (String) e.nextElement(...