tandem recursive algorithm process