search for: hasmoreel

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

2008 Apr 06
3
Multiset Permutations
...(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(); } return out; } private static int Factorial(int n){ int fact = 1; for(int i=2; i<=n; i++){ fact *= i; } return fact; } public static void main(String[] args){ char[] set = new char[]{'A', 'A', 'B', ...