You are on page 1of 12

Lecture – 02

Recursion &
Backtracking
ALGO++
• Recursion & Backtracking
• Problems

Prateek Narang
Time To Try ?
Given numbers are mapped as
1–A
2–B
3–C
.
.
26 – Z
Print all possible combinations for given a
integer. Eg 123 = ABC,LC,LW

ALGO++ 2
N-Queen Problem

ALGO++ 3
Permutations of a String

ALGO++ 4
Unique Permutations

ALGO++ 5
SET Data Structure : STL

ALGO++ 6
Sudoku Solver
Create a Sudoku Solver and Checker

ALGO++ 7
Sample Input
int mat[9][9] =
{{5,3,0,0,7,0,0,0,0},
{6,0,0,1,9,5,0,0,0},
{0,9,8,0,0,0,0,6,0},
{8,0,0,0,6,0,0,0,3},
{4,0,0,8,0,3,0,0,1},
{7,0,0,0,2,0,0,0,6},
{0,6,0,0,0,0,2,8,0},
{0,0,0,4,1,9,0,0,5},
{0,0,0,0,8,0,0,7,9}};

ALGO++ 8
Rat in a Maze

ALGO++ 9
Phone Keypad

ALGO++ 10
Optimal Game Strategy

ALGO++ 11
Thank you
ALGO++

Prateek Narang

You might also like