user11616868
user11616868

Reputation: 1

Is there a maximum number of repetition when using recursion?

I m trying to make a sudoku solver,with basic knowledge,using recursion.It solved sudoku puzzles i entered as long as the number of repetition is less than 3485/3500.Every time it fails it fails somewhere around that number.So i was wondering is there a threshold or is it my mistake?

Upvotes: 0

Views: 46

Answers (1)

John3136
John3136

Reputation: 29266

Each call takes some stack space. When you call things recursively, the first call is still going on while the second one starts, so you are using stack space for 2 calls. If call#2 makes call#3 then your stack contains 3 calls and so on.

The recursion limit is based on how much stack you have.

Upvotes: 3

Related Questions