0 ratings0% found this document useful (0 votes) 91 views10 pagesAOA Module1 Notes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
— AOA
——___Intopverion, a ase
ee a . — . _ a —
70 Hslhact is Algoxithmn ancl state its Characteristics,
_Ans | —_Alo_atooritiam is a_welt= defined computodtonal
Steps or_procedure thot take Some _value_orset of
Pekso-s_lnput_ cmd proceduces Some Value or setof
J vralres oes Output a
Fe al oe _
_ | CHARACTER igties | fave ets == —
| ©_INPUT | zero 9 more quantifies ox externally.mustbe
ce — Supplied
—rusF he 7
__—_|}© 0uTPuT | Atleast one quantity is produced os eucpuh
__]@ derinmemess » Lach lnsttuction must beclear and
=n unambiguous +...
____|@-Finemess:: For atl cases te algo:
Jo. OF tery a Piatt number of 6 : Lt
© Erreciveness - Zach Jostuchon murt be base enough +0
J be Catered cut -
re_ must terminates _
—®] Explain space complexity of an_algorithm:
—Ans_|| A _Spoce complexity 1s _clefided as the amount
of im emory Seguesting ana (gortthinn to asun
i Space Complexity. /s —Cormputecd tidiiag, ure Lactor
Lie o> Constant chanacteustics
___b)_Instence chanacter
ssc sp _ = =
Where, © — Constant
Sp > Variable
Space _complexy teiclenoted boy Sen) to specify —
the Space c omplexity of problem for_inpud Size meYatin Jatth
—
App ARRAY (A, B)
for \ Recursion Gee Metho :
—_|_ 9) Master Method ———
A) SOBSITUTION METH OD
The Solutten 's guessed anc rrathe matical.
——Linduction is. used to prove Wack He __
——llauess {5 Correct or incorrect Ja.this
| method - a
———--Exenaple 4 ______ _ ——
Re cuxrente relation 1 ren) = 7 = Toa): +O _______
~~] Apt condition » TCO) =o —
—] say oe a poe
net then Tee TOD PE
~_]| TCO) 41
~] ort
=| Tlo-) +L
= - Te1) +hYatin Jathhay
Tejasvi Bhava =3, then Toad: Tat + +8
eS +13 >
_ hi B+ 3 — -
“2 =6 =
a Ton) —
1 )
2 2 z=
ie 3 s|3 g
Le
Ton) = acne) -
z
= (At+ AD/
w= O(n*)— s
8) RecoRSION “TREE ma ETHOD ss
Male cleaw a recussions tree and Calculate
the dime tate n |s ye Mey levet of +he_ :
dree §
|| rocky, w2e 4 Lon
he tworls clone at the
Nett: Ve ele 0 oe
4 To 'cl-auww the recursion “thee. we Start
| From sine given Te cuxnene retation and —
| Ieop_clroreimg Hitt we find oo pattern among —
the lewets-
Z Thi potter is cnaial | typically
| axritametitc on geome fue Series, -
| Example 1 _ = _
Recurrence “retatton : TOn)= a TCas) +).
Sot
bet stort d-ciwing the mecuvrstue
tree of the given. re Curryerce retation. =classmate. |
= SS
v n
Cala.) DENTS
GR
| fen) must be pes
CB €) OB hy OH ae
Pro se en a
Lhe at pinof ine tree is loan
| sHe nce) th total Cos+ = ntogn
= Olnloan)
LO MASTER Metaan
I In tnt methed, It is a clivect wey
to get Lullon of gives Tecurrence relat ed
I “Thr netnod Loorks only for the fol \__—
typeof me currrenres!
Tony = aT (Olb) 4 £Cn)
| tonere ~ -
a constant a2
o2 diancdt tis so
e constant
a
Case!) If Ptny ts of where ceo, tres
| @ tf ace, ton)= o(n9)
LE E 4 —
@_ if O=b, TON) = O04 fog.n)
0 if a> bt Ten) = ines **)
Case 2. tft £tn) ts (nl) thes
Tons © Cals be)
TE fen) is C9* legk nn) then
Tony = OC Ae log! og)Date__>>
Page
png
Femmes enn B Tene OT
Sot”
Kamporing 9-0 E og
Tend so =O
ee
se
we set Ara eA
Peay dee
asa be2 ftn= 5
Sine —£ Co) ee ela
oe
Fram case | — :
azg_b*: = 2°
Pp BIg
a» bi
| tk Bu ca [(®) 4,
Tin) = Cn”)
= O(n h9F)
| = (n't)
OC nen)
= OCn™) 7 i : ae
Ten) = O(n3) =
Hen this uray we Con Pind the iene complet,
et siven Tecurre nce with caster method
i
Used
@® Recurrene retots on
be elued using masice method .
Gem effect. voli ae jprcne st —
Hoe runing time of recursive _ elgoritinn = —
te (ime Complexity of Certain ec enie Say
oa ee