Question

Consider a simplified backtracking approach for generating permutations of [1, 2, 3]. If the current partial permutation is [1, 3], what is the next logical step in the backtracking process?

A Add 2 to get [1, 3, 2].
B Backtrack, remove 3, and try to place 2 after 1 to get [1, 2].
C Terminate as [1, 3] is not a full permutation.
D Start over from an empty permutation.
E Add 1 again to get [1, 3, 1].
Practice Next

Hey! Ask a query