Recursion2 Jan
Recursion2 Jan
Good
morning
Contend
01
Quizzes
02 Tower of Hanoi pure recursion
03 Generate parenthesis Backtracking
void solve int
if N ol return I
2 lol
solve N 11 solve i
solve at 12
3
solve 31 12
Ans 1 2 3
73
02 void solve int NI
if N ol return I solve lol I
solve 21 123
Solve N 11 3
solve 131 123
3
Ans 3 2 1
Output 1 A C
n 2
I
2
1 A B
2 A C
1 B C
output 1 A B
2 A C
1 B C
Ed's
3
3 A C
i B A
2 B C
I A C
xdisk .IT
it n 0 return
Tom n t A C B
print n a c
Tom n t B A C
to tomf1 sc I to ÉI
Tony B.CI
1 A C
2 B
ton GB Tomfo B
1 C B
3 A C
1 B A
2 B C
I A C
1 2n
si O n
8 09 AM 8 19 ATT
Q print all of length 2H
validyndparanthesis
for a
given value
Equal no of opening
closing brackets
N I I C
N 3 71 17 7 11 17 111
7 11
back track
Words expressed
as Branches
Find AIM
BF to find Aim Generate the entire word on one
ten D
C 11 C 7
f open n
l
at Cisc is
invalid
void main 1
recur N O 0
it open N 14
recur Str N 1 close
open
if close open
TC 2n
SC O n
f x.nl
it n ol ref 1
else if n 2 of ret f
els
Bits 1
sort A
target
Alex
4 1
S S
Is 1
times
Alen 0 4 4 8
I
9
Sam s
Alex 0 4 31 4 28 9
Sam S S S S S
some
1 2 1 2 5 6
10
g
5 6 6 5