Wednesday, May 13, 2020

Questions on N Queens Problem

1. Why matrix is inefficient?
2. How is recursive calls made in preorder traversal of the tree?
3. How to generate all of the permutations and all of the subsets of n distinct elements?
4. Print all of the subsets of the elements in a list. Input: [a, b, c]
5. Which part of the code does backtracking?
6. What does the solution space tree look like?
7. Why it is DP? Does it satisfy optimality? Subproblem?
8. When to use backtracking?
9. How call stacks are called with for loop? What is returned?
10. What happens when we backtrack?
11. How to determine the base case?
12. What is the time complexity?
13. What is the space complexity?
14. What data structures to use?
15. How to check if a position is in a diagonal?
16. How to identify a backtracking problem?
17. When do we stop making choices?
18. When does the undo happen? (only when the choice is invalid?)
19. How many wrapper functions do we need? What parameters are needed?
20. What are the subproblems?