# CodeStepByStep

## eightqueens_concepts

Language/Type: Python recursion backtracking

Answer the following questions about the implementation of a recursive `eight_queens` function:

 If an 8 Queens algorithm tried every possible square on the board for placing each queen, how many entries are there at the 8th and final level of its full decision tree? (64*63*62*61*60*59*58*57) = 1.78e14 (8 ** 8) = 16,777,216 (64*8) = 512 infinity (64*64*64*64*64*64*64*64) = 4.72e21 (order shuffled) What does a better algorithm do to avoid having to explore so many possibilities? Randomly skip certain squares based on a heuristic. Limit to placing only one queen in each column or row of the board. Use a dictionary to increase the efficiency of the algorithm. Compute all correct answers ahead of time and save them in a cache. Raise an error because the problem is too computationally expensive to solve. (order shuffled) How do we make an 8 Queens exploration function that stops once it finds one solution to the problem? Use a return statement to exit all recursive calls. Raise an error if more than one solution prints out. Print all solutions, but then erase the output to hide it. Return a bool value of True when finding a solution, and checking for this in each call. Call the exit() function to quit the program after finding a solution. (order shuffled)