Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3. (15 points) Asymptotics. Let n = k2 for some positive integer k. A Sudoku solution is an n xn array of numbers, each in
3. (15 points) Asymptotics. Let n = k2 for some positive integer k. A Sudoku solution is an n xn array of numbers, each in the set {1,..., n}, such that the same number does not occur (1) twice in a row, (2) twice in a column, and (3) twice in a k x k square box, where the whole array is divided into n such boxes. Given an array as input, we want to determine whether it is a Sudoku solution. (a) (5 points) Give an O(n) time algorithm to solve this problem. (b) (5 points) Give an O(na) time algorithm to solve this problem. (c) (5 points) Give an N(n?) lower bound for this problem, by showing that any algorithm that makes fewer than na queries to entries of the input array cannot be correct for all possible inputs. 3. (15 points) Asymptotics. Let n = k2 for some positive integer k. A Sudoku solution is an n xn array of numbers, each in the set {1,..., n}, such that the same number does not occur (1) twice in a row, (2) twice in a column, and (3) twice in a k x k square box, where the whole array is divided into n such boxes. Given an array as input, we want to determine whether it is a Sudoku solution. (a) (5 points) Give an O(n) time algorithm to solve this problem. (b) (5 points) Give an O(na) time algorithm to solve this problem. (c) (5 points) Give an N(n?) lower bound for this problem, by showing that any algorithm that makes fewer than na queries to entries of the input array cannot be correct for all possible inputs
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