0% found this document useful (0 votes)
18 views14 pages

Scrubber Notes Recursion Babbar

This document discusses recursion, which is a method for solving complex problems by breaking them down into smaller subproblems of the same type. Recursion involves defining a function that calls itself repeatedly until a base case is reached. As an example, factorials can be calculated recursively by defining a function that multiplies a number by the factorial of one less. The key aspects of recursion are a recursive call, base case(s) to stop further recursion, and returning a result.

Uploaded by

Aman Singh
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)
18 views14 pages

Scrubber Notes Recursion Babbar

This document discusses recursion, which is a method for solving complex problems by breaking them down into smaller subproblems of the same type. Recursion involves defining a function that calls itself repeatedly until a base case is reached. As an example, factorials can be calculated recursively by defining a function that multiplies a number by the factorial of one less. The key aspects of recursion are a recursive call, base case(s) to stop further recursion, and returning a result.

Uploaded by

Aman Singh
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
You are on page 1/ 14

Recursion


what →
7

§B →
Function calls
¥f_Doo2

( E- sohecintn )

solve ( ) ;
n

g-

Big / Complex
Problem 1ha solution
↳ same
type
olti problem

Recursion
⇐ zn →

2
"
=
2✗2✗#2
4
2 2 ✗ 23
24 =
2×23

23--2×2-2
2
"
= 2×23
I =
2×2-1
-1
2h zn
2--2×200
=
z ✗

ñÉwÉr-¥=z×µn
"
4

I
sakgao

Base
case/Gndh@
① factorial
51=5×4×3 ✗ 2×1

4-
=3 ✗ 4
!

51=5×41
51--5×4 ! &

4=4×31

n
! = n ✗ ( n -
D!
3.1--3×21
-
An)= n ✗ Fln 1) -

21--2×11
ft f -

Big ohoiti
1=1
' ,
ok mx④
L

KID
Base
yretYnonad-Y.ir
↳ Base caE→Rug

↳ Reenssiuerlation

Bas③→
4
No →

Yu
h
Factorial (

Rukia Kah 52
sai "
2

Ig
¥
¥ .

- .
"

Bare - 6h

4
Martetoye
fado%Fe.ee sink
&

÷÷÷÷i-?¥③,¥m☐→
rainy
out
¥?
n=O
n@rs.É→
h
c→
h
Bc→F
'
'
.
-

D. ( → F B. c→tRUL

, ÷ ÷÷
"" "

"=z×
sP=① sp=①

¥÷i÷÷÷÷÷¥
<

)
, ,
its Bp=nxsp 11-7
- BP BP=n× "
,
23×2 -1×1
- Bp =L

:*
main C)
→%n☒,au☐Ñt→⑥
Remrsiontr.ec
@

¥#-%¥
Recusivefunction mandatory
petain
↳ Base caÉ→

wy.I.F-ss.com#r.I ) Procuring
Kat
↳ capote it
,
-
-

,
+1
,
2

fun c C) fun C)

{

Tail ☒ that

Recusing
run
"☒r ¥
3 3
Print
counting
-

ilp →
n=5=
01 p → 5 4 3 2 L

input
cont
⑧ɱ☒§
er

É
¥
£
age
D-
6 →
4
B c→
-
F
-
i •→ ☐ ↳ ftp.I.fi?E?r.- te

'

n→ r.pe 11
.

II

±÷÷¥÷:¥⇐¥
.
.

→ Rip -
-

Pip

13 cot

main
If
Recusing : -

@

factoid
Do amulet

You might also like