Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Matthew Zhang] - Backtracking Algorithm with number constraints #74

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

caspinprince
Copy link

Overview:

Implemented a Sudoku Solving algorithm using backtracking. Used arrays to represent rows, columns and sub-boxes of the grid to make checking for valid operations more efficient.

Time Complexity Explanation:

The time complexity of this algorithm is difficult to determine exactly as it depends on the input puzzle. Technically we can say it is constant, but the constant is very large so it may be worth analyzing the exact number of operations. In the worst case, the algorithm starts with an empty grid and tries every possible combination, which would result in O(9^(n^2)) for an n*n grid (n=9 for standard Sudoku). However, the average case is much better due to early stopping when an invalid state is reached.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant