Your code here...
void search(int k) {
if (k == n) {
// process subset
} else {
search(k+1);
subset.push_back(k);
search(k+1);
subset.pop_back();
}
}
I am having a really hard time understand this code. I especially don't understand how 'k' turns to 2 after 'k' reaches 3. I think It's related to the thing backtracking. Someone plz help!!!