A more efficient way to find all permutations of a short String in a long String than O(n!)
A more efficient way to find all permutations of a short String in a long String than O(n!)
The time complexity of this algorithm should be O(n^2 log(n)), or since the short String and long Strings are necessarily different lengths, it could also be viewed as O(m*nlog(n)).
I put the driver in a folder because that’s how it was on my file system. Reorganize as necessary, but be sure to change the destination for your PrintWriter to reflect your changes.