The meaning of parallel is not that of parallel processing. I simply mean that if algorithms A and B are represented by the two sequence of operations (a_1, a_2, ...) and (b_1, b_2, ...), then the executed sequence of operations is (a_1, b_1, a_2, b_2, ...). It is not compulsory to be strictly 1 operation from A followed by 1 operation of B. This number may vary. Nonetheless, this should work on systems with only one thread of execution (without built-in parallelism).
The "merged" algorithm that is derived should terminate its execution when either A or B terminates.
The two functions A and B share all their input data, but they wont perform any write operation upon them.
How could I implement it in C++?