How to limit memory use? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to limit memory use?

I wrote a 4x4 sudocu solver which works just fine. This was meant to be expanded to a 9x9 solver but as i feared, it exceeds the memory limit. I am asking for help to make the code less memory consuming so that maybe, i can make the 9x9 solver run on sololearn. https://code.sololearn.com/cAdeJbf9f3zX/?ref=app https://code.sololearn.com/chX1fbjGYWSy/?ref=app

4th Sep 2018, 8:26 AM
davy hermans
davy hermans - avatar
3 Answers
+ 2
permutations generates n! possibilities, so you have 9n! rows. this is way too memory consuming so you could try a better approach: https://en.m.wikipedia.org/wiki/Sudoku_solving_algorithms
4th Sep 2018, 11:38 AM
hinanawi
hinanawi - avatar
+ 2
thanks for the help! i will give it one more try on my own. regardless of the outcome i will look at the algoritms you posted.
4th Sep 2018, 7:54 PM
davy hermans
davy hermans - avatar
+ 1
i improved the 9x9 code. it still takes more time than the playground gives for minimal input but it works on a sudocu with about 35 numbers.
9th Sep 2018, 6:51 PM
davy hermans
davy hermans - avatar