The best programs are written so that computing machines can perform them quickly and so that human beings can understand them clearly. A programmer is ideally an essayist who works with traditional aesthetic and literary forms as well as mathematical concepts, to communicate the way that an algorithm works and to convince a reader that the results will be correct. ― Donald E. Knuth

# Algorithms

## Miscellaneous

Problem :-
Given 2 strings, find all possible interleaved combination of the characters of the 2 strings.
Consider two strings " AB " & " PQ ".
Possible interleaved combination are :-
ABPQ | APBQ | APQB | PABQ | PAQB | PQAB

Solution :-
This problem is similar to the balanced parenthesis problem discussed earlier.
There are two possible options of interleaving characters of two strings.
1 ) First character of the interleaved string is from first string str1. We will recursively consider all the characters of str1 and str2 to obtain possible interleaved combinations.
2 ) First character of the interleaved string is from second string str2. We will follow the same recursive technique. See the implementation below.