You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dfs, input: [1,2,3]
depth0: []
depth1: [1]
depth2: [1,2], [1,3]
depth3: [1,2,3], [1,3,2]
when depth == length, end the current search;
when come to [1,2,3], try backtrack to [1], release used[2], the loop i come to 2, stack push into the path, [1,3]....
dfs, input: [1,2,3]
depth0: []
depth1: [1]
depth2: [1,2], [1,3]
depth3: [1,2,3], [1,3,2]
when depth == length, end the current search;
when come to [1,2,3], try backtrack to [1], release used[2], the loop i come to 2, stack push into the path, [1,3]....
走完第一个循环[1,2,3]后,弹出3,弹出2,把标记3,2 使用过的used数组还原成false, 继续走for循环,used[2]为false,压入栈中得[1,3]
再进行深度遍历,depth=3...
The text was updated successfully, but these errors were encountered: