Answered step by step
Verified Expert Solution
Link Copied!

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 1-9 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 N is the size of the 2D board.
\table[[1,8,9,],[5,{f66c7d0f9-1ffe-4bb1-9ed0-0ba7d7b4deaa}
\table[[6,1]]\right\rvert,,2,],[,\table[[5,3]],,],[96,48,83,\table[[6,2,4,5,9,3,7,8,1]]],[3,6,51,],[1.,\table[[9,8,4]],46,\table[[3,4,8,2,6,7,1,9,5]]],[,75,,],[8,\table[[3,9]],7,],[,11,3,]]
for (int num =1; gum & 9; numt+)
if (posok(grid, row, col, num))
grid[row][ COl;
if (solveSudokuR (grid, ror, col +1,N)
J
return true;
r
grid [rOW][COl]=0;
}
return false;
Answer the following questions about the above code. For parts a-e you will write specific line numbers. Part f is a running time related question.
(c)(2 points) Which set of line(s) determines all the possible permutations
(d)(1 point) Which set of line(s) handles the bounds check?
(e)(1 point) Which set of line(s) updates the partial solution?
(f)(1 point) Whacks?
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Power Of Numbers In Health Care A Students Journey In Data Analysis

Authors: Kaiden

1st Edition

8119747887, 978-8119747887

More Books

Students also viewed these Databases questions

Question

=+1. How important is this situation to the organization's mission?

Answered: 1 week ago