Nikhita (CS) 1 Assig.

You might also like

Download as pdf
Download as pdf
You are on page 1of 12
oe * ao a Lb pe mean’ ae a - ths anol comp pe Se Lt ge ee a Cally © of, wally | of a tet)’ ints 2 Hpece ge “ec Spier 15.94 pa ee fen amental _ Ou _Cony “fre —w—_|_ setence 4 useol — a _vernodss pl |_ anol ei eine : i | Theke aw numeyous (tet —2 alporthons | wWeth cus Oly ethims, each ~ Commo: Cr-clu torte ‘hms poor tine __ comflexcts and 4 not putlable for. yecwrsively- 2 Nort ba oliutle- and ~ Sol Hg algort'them that . oles’ —_ tho 8 list inka Uraller © | publite © sorts them, anol phen merges them — back, Logether tn__bortted oiler. “TH has a > time cbmplercty of —rtogn) and is stable. ~ any sae ae and Binary & (sees wrth Exconple ? % Linear Search i ie ~ = Liehed wading each a call te” tay cient a fall Oo — extive _dineaybeorch also 05 known Ga Beguerlial gearch , Works fc _ element ty ___the Colleckiton coklediion bos beh eorchecl. — a E Complextty s The __tesme copy fie peat —~ Bo] 4 0d the_ i BT mario lash a Collectors. Ins the west “case, it have to geayth Perough _¢ al clements “te fence the Langet: Example;- _deth Soy you hare an aarmy. of - a CaS» [sore te : ES, 8, 12, 15, 20, 25, 30] : Yon (incl fhe elements 18 wit en Can cae ae __| phe beg ining {tex Se one “by Gne, a as BY at oe E bas 7 f B | Binary Search :- - 7 Ea" "3 ASL ne ae ee ie ee ee | np = The time Complexity of binary I “T— _ Searh & 0 OV a, 2 (the Hb “be fe | _ - [Examples an L number of ele ments inthe callecé: Ie td te than nent pearh olalad a sae the sbame— dented erred]. nt OE ea ame 26,37 want to Jno jhe element 15 ou. ‘dag binary bearth , the earth wo pe Seed Cows “ylollocos é | Con paste | Compare Scnce _15<20,~ Seonch he aft heft CE207'. ak So iS Be the vtaht — hald: ore Shae 3o]’. v 15 wlth phe méolelle element (20). 15 wet fhe méolol. element cs). have_ peal the target clement. Busi! Ars: [ | ia Thy end WK ess ape om CESS nh 2 Kei ___ Tpevre we Ahifferent | agrougs, " (nelucln ee on mut clrimenston | AVN Epa poy and its a _(n detail ~ fae a Te a. funclamental olata Hala ae in Computer Sevence_ — whet ge to stove a ' collechin sein tare we ace ype. A ae are. bial olocta off cevent hee _el oa ae ee an tnoler a ae ee le—_oleimense tl Sn acres auol spare ‘Sig _ Demengconot Array & _ A “Single — olimenstonal s » albo Known “os aV one- climensconal _ alia, fre | Seimplest ftom af am are ey: he Concerts a_thear Collection ca elements _|_@ ~ Segue. oll fe ae cial. ys a (Zack eloyront tw fhe av a accessed. mar? mn m_tlen, bterlg pee 0 a fhe tee A Dr es, _abioeshanal arog 8 an amr _ Shot __contatne other ary aa th ele eH & useol le vepresent. clata tr _mutteple _olimenscons, Such as a matnx (2 ay me Oe a. tebe 088 | laminas os ee | - . — Feel. “element wiv a mult’- plomensronabl f {L ra _& accessecl —_uatng multiple tnolives 7 ____|| fo “spect, y wD positeon! tn__each oltmenston: aos Sbarse Array gs x A _Apoase_ as cisd Wom _arvey im which ‘mo. hdve_fh —oledautt © Value Cubtially zeman null) Unlike Zeqular or regts Ap bpotse arvre air anol mad in cleft C I~ Ke. non nt Volues., ee an I _pettiicclorly useful eben clealen, ye ol ets where 7 elements Kore ov when ep pleseling ae dala. la bhutan Ke _Aporse._ _Natatek, = Hg oy “feray ae T tinked. list + = Stack lock ba Linear clot. ddxuctirr| = frat. folloas a. pertersuborr _orsofor iv which pit gpe ae are _pexfowm: }_—_| The alee may__© CurFo Cledt “tin fers § | acct) oy___ FILO (fox in loot out) LE FO pant fret eae Shock | ee a nse , Com Implementation _q Slack s-~ Jheve ate tuo ae ae 7 woye to | Gnplement Beak V A ae ee Gr arvog tmp lementation on aoe back ins favo ‘Alt fe _dopevater wes ‘dtack. Ae perform — Rosny Poe |e = apa a tnsert an element. ree == __btack: Eg ef PuthO. me | 30 ff Top +4 2 op + 4 La | 4o | Thp+ 4 30 Top +4 Eg ci Pop () 30 -L cay 10 Top - 4 4o Top -4 [0] Tp wd \ CRAPO ey foo DRO RUReSe errno ee: Sl (P (Pua Coole) « Ty Pal fet ee cans Push (8; Grae es 4 sad cease —— _(4top_=_ max-1) _ J - = pine Fits Stack ovrf ae oe OE = ope pe stags Se tine Complexity = ott) - ae BAD sam aed fo pe ars a - ae = Pt na —_ a tse cap Ua pa ef = oa: ae yeturn X ; — ; “| De a Spitax of Top e- ee “Algo ee Begs ag ee : yeturn stack [top] eer nananea i _ endl procecluse ae ie ue (9 if timplyr- Ratuwm awe Mack dd . I Ee cep i e . oma ale. fale ack | ae ee ® Ea ee a- Using Linked List - A longed tat 5 a _ =Collectiion c LOS Connectedl . log ether. “cD Linke = These. “pode : Consest pil clata +o be fhe. btoweol _anol_a potntes to the addres of the nett Nwtocde uid. <>. the tinged lat. ari Yn jhe Cage $f ann 5 the fe Lies o _lintect to whee te on ebay ee te adie ie daa Vine tite Ang amount. ee eee can’ be__stoxeck : th! it and eon be clolotesl foom_ ae __|@_ Sen, mpi lor. Unkecl tt _ CSeng ty) oe i deeb’ -Onted et ee (© Crear _lénketl lat ait ee Implementation ~4 btack ay Linted Lips - S| push poration & Sette a ees Se, Gnelatexe anode - +} Update — the ae dot ole Ip dah E Le, nocle + clata = Late iy hee pe node to top / Linked tet. And ot a a he _cucryentnode. a= | Fowt Chek” “wheter Hae a wiy Pole present in > fe _linkecl_ Last Fox not, ¥ [ not theyveteurn . ae acts al Néeo “eta - aarp domp tee it ao 4 Now free era temp node Poe ae _ feck Gperoititon = Beles At ge ical iii a Ss ansitetene i __#| Tare serps fd Gutta like 6. wns : pe us rer “fhe Value [emp naa tae | Disploy _Opeseition 1 i ——— oo Thane a temp node and. tnitinlenc it witte | _Neée- | Otherovse make - ee wear Kay —temp mp ta top__node___amd___move___“forerrd te __ She top nodle — eo 1 - Step . - em Wee top povnter- | encounters emp mM an a povntese Saas Now Moot toaversting temp tee et encetent ors A _ Seimeettane ously _prcat the value of He temp

You might also like