I want to create all possible 5 alphabetic words using az. Please suggest any good and fast algorithms.
I tried to create one and it looks something like this ...
byte[] allchar=new byte[] {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; int lengthOfAllChar=allchar.length; System.out.println(lengthOfAllChar); for (int i = 0; i < lengthOfAllChar; i++){ for(int j = 0; i < lengthOfAllChar; j++){ StringBuffer finalWordBuffer = new StringBuffer(); finalWordBuffer.append((char)allchar[i]); finalWordBuffer.append((char)allchar[j]); } }
java algorithm logic
Autometa
source share