Giter Site home page Giter Site logo

sudoku-solver's People

Contributors

alglus avatar

Watchers

 avatar

sudoku-solver's Issues

Rows list too long

When converting a sudoku of size L into a cover problem, a matrix is generated with the size:

  • columns:
  • rows:

So for a 25x25 sudoku the rows list is already 15625 elements long. Every access to an element becomes very expensive.

So an idea is to somehow split the list into k sub-lists and access the one corresponding to the desired index. This would reduce the time complexity from O(n) to O(k + n/k)

Column size: wrong incrementation and decrementation

Currently the minimal column is calculated with the function updateCols. It has a time complexity of O(n*m), which is not ideal.

This was a quick fix for a bug when decrementing or incrementing each column size after covering a cell.
The problem was, that after some rounds of backtracking, some column had a size of n>0, but no uncovered cells left. So the function head run into an error.

Correct this bug and change the size of each column directly when cov/uncovering a cell. Then just go through the columns list and search for the minimum, which would be O(n).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.