0% found this document useful (0 votes)
3 views4 pages

Time Complexity

Software

Uploaded by

Faizan Mujahid
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
0% found this document useful (0 votes)
3 views4 pages

Time Complexity

Software

Uploaded by

Faizan Mujahid
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
= Time Ga ity: “Estimation of er cae de tak py uhth He bp vithns wee Letinedl, i —— Types —— 1)_8ig-Oh_Notarions ** fy ts Ofe)) if toe exist — fo. die nunber ¢ and N_ sth at LODe-90e —4 ‘be all DEN i f an OS) fel pe: #3nr1 -log@) where 96o)= while cancblate for C—— Cand N aro ~loang: — 2 fiz) 2 |e 6] 3 pees ce “five e.g) < Je An ti 2 ¢ or) Faxtopeche ong > rd Big-Oh 1s also calleol worst= case complereity upper- batinel ‘ if) Q And © Notations: Biy- Omen (C2) Netation: “© /yn)_is 2 Qe if there exit posite numbers C ard N such that for2e9(n) Jn_all_ n> N. ri ede fio) = (nan t4 din) = 2(") , sane_as__big-Oh. nei abo Lew or IT Nn O(theta) Notation: “fm is Ofgm)) if ere exit pesittve numbers Cy oe and _WV_suith that 0906) sf 4c) | _for_af! non” ay a Ato called? average boundl or exael case. example; : int__LinearSeaveh (fat Are], fat size, fot value) for(int to, fasizes fre) pacer if( Ar{it]== value) p. = refun_ ts a return -15 30 = 7 Worst, O(n): Bet: QC —Exadz_ O(9) ‘How To calewlateT n cre Leops: n>0 1 fo (fot toos feng tos) [oct feng tapos t=) a(n) cout 2c" Helles ye coutec" Helles + ‘ a —e-e5)} OLR RUS ae forlinx_f20y fang _te=2) es ens nt for (int tony tyos tee) ary) 20[n) course" Mette": Wel couree” Helles 30) 7 oases + 2 ny ow Va aoe x 2 foclink tos fans Teste) for tox ; courte “Wello's oo — 9 cout ze" Hello” » OW olny S]io oe) Ghd i Che int azos while(aan) iot_a=wy, while (aso) O—N t courte" Hetlo's § coutee Helles atta) of") ater. $ a=>3$ >, | J ee \A eu Muttiptictive/ Divisional trop s: Soe (iit tp: tems _ie=2) fovlict fang ips; ie2) coutec Helles tay course “ Welto''s 0 ae Q eat eae ey} Aov(iog tots tong ters) | for(int tens fas i= 3) — Cour ce "Hell o"s cours Helios leo Aan 3 faction ot _Qeiy for a=ns i whilecacn) § Se While (a>) ee ai : _courze" Wento"s coutzé "He tlo"s ‘ Qx=2: ai=23 3 are —_ fovlint Tso; fans ix=2) leq peacce | Ge Ge Se ra: rs ! coutee"Helle’s NX infwute. | Combination af loops: Nested! (pops: _ i for(int (=o; oo) Cour es" Hello ie felint_t ig=2) 0 outed H "Hello", Zi Re adpalgn) 3 =O(n) § Por (tot t= 05 aes isa) OA fens ter) <0 ny A) 7 OD ee 2 go coutze" Helle’ For (int feos i¥tang fxr) a) cout Le Helos foclick '205 iungi4+)f fein ag tous a coutze" Hello's £ oleae) olny) tnt a= > Ss while ay 4 1) § ‘an ‘nk b=oe —2 ball coutze He lo" while (6 en) § WA WAKA 2 Cena outer Hale's 5 alr’) lS kno = er dh a fs Wy> KN where Wis foput size, what ave epper and. fruser 5 bounds fy gaesth rate of the pingraim ? Do not ——foget_to Ries, the _constartts (c ae pase fern ti can #7 qos eae upper bund: ofr) a beundt (N*) ~£" and ‘Ny’! Pin 26-900) 4? + SN'+ 6N +74 e-90) yn? ONFEN +72 Co er fuss, gt 2c) L NEN Ne a 92)|8$ esas |sa| — (WC nia{2 [3 jals[— N=' G+ $4 647=22 N=2 ut af + ee = a = Ave im N23 Ut s+ Se See MiB eS a ee oT Ney 4 a Cate Ge hill fe 4 ies (Come Ca) 6Yy ey NES” OSS Sir Sea ore Seer See {i200 _ PAS EGine Gypsy ao | pod pe = — it

You might also like