I found a link online that shows an algorithm to generate all combinations of a string: http://www.mytechinterviews.com/combinations-of-a-string
Algorithm is copied belo
outstr.deleteCharAt(outstr.length() - 1);
means that you have
n^(n-1)/2 pairs of combinations.
The iterative for-loop doesn't stop after the recursive function call so you need to delete the last char in the output buffer because you don't want to get
n^n/2 pairs of combinations.
In a graph theory it would be a short circuit.