0% found this document useful (0 votes)
36 views23 pages

Recursion and Backtracking Techniques

The document discusses several algorithms including recursion to find the length of an array, generating all subsets of an integer array using recursion and backtracking, solving the N-queens problem using backtracking, and the rules for a valid sudoku solution requiring each number 1-9 to only occur once in each row, column, and 3x3 sub-box.

Uploaded by

Rhythm Das
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views23 pages

Recursion and Backtracking Techniques

The document discusses several algorithms including recursion to find the length of an array, generating all subsets of an integer array using recursion and backtracking, solving the N-queens problem using backtracking, and the rules for a valid sudoku solution requiring each number 1-9 to only occur once in each row, column, and 3x3 sub-box.

Uploaded by

Rhythm Das
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Recursion & Backtracking

- Karun Karthik
Recursion

Length of an array

Power of 2
Given an integer array nums, generate all the subsets.

* Once index is greater than or equal to size then store in result


N-queens
A sudoku solution must satisfy all of the following rules:
1 Each of the digits 1-9 must occur exactly once in each row.
2 Each of the digits 1-9 must occur exactly once in each column.
3 Each of the digits 1-9 must occur exactly once in each of the 9 3x3 sub-boxes of
the grid.

You might also like