co-recursion bfs dfs subsetsum