Consider the following function:set of vectors P.// this set P is global and emptyvoid f(set S, vector v){if(S is empty){insert v into P;return;}for( i = n to 1 ){if( i in S ){v.push_at_back(i);// appendf(S\{i} , v); // S\{i} is S after removing iv.pop_from_back();// erase last element}}}
The function is called with the following values of S, v
S = {1, 2, 3, ..., n}
Read more… (41 words)