Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This question relates to understanding backtracking code solution that solves a sudoku puzzle. According to a quick Google search, Sudoku is a puzzle in which
This question relates to understanding backtracking code solution that solves a sudoku puzzle. According to a quick Google search, Sudoku is a puzzle in which players insert the numbers into a grid consisting of nine squares subdivided into a further nine smaller squares in such a way that every number appears once in each horizontal line, vertical line, and square. The general input grid contains some numbers already placed in The following figure shows the input and output outcome. Note: posOk is a method that checks if the number is in a valid spot and it runs in constant time. Also, the last parameter is the size of the board.
tablefcdfffebbedbadbdeaa
tablerightrverttabletabletabletabletable
for int num ; gum & ; numt
if posokgrid row, col, num
gridrow COl;
if solveSudokuR grid ror, col
J
return true;
r
grid ;
return false;
Answer the following questions about the above code. For parts ae you will write specific line numbers. Part is a running time related question.
c points Which set of lines determines all the possible permutations
d point Which set of lines handles the bounds check?
e point Which set of lines updates the partial solution?
f point Whacks?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started