0% found this document useful (0 votes)
20 views15 pages

Unit 2

unit 2 dsa
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)
20 views15 pages

Unit 2

unit 2 dsa
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
You are on page 1/ 15
J ppstack % olay: Eee s , (2 UFO F Last an First_ovt* [fr enleton se vse Tap eto! Ay Ppplications oP stncks + @ Reuursion - on |B conuerston ot expressionseit Cr EO ine. into protii/paac ns” and }? atin oprsite eho an a tab Probie, exp5on, abit —) poattin expression, [@ Expression Trees. RQ st 6 © art apMetheds for, Baplemertiog stroke | Two r oy using “prays! if @ey Uisieg “ Unkes Listy), > fer Fear operations. »i\) Oph Gp @ reek’ or Bncks AND @UvE ) “Lafo, Dit structure & for treating wn une push copeetioe © 24eq (og Scanned with CamScanner © BBcpementing stacks ry Aue So ateially we initialize Top fred as © je “top ae Swe use Tops SCMAxT, = ‘oot | @Rer mpi « “metes_vorfahle } iotbalty “Top =o1' ; pte’ means Andi Name anc Snax! ts size © strmar fey Nore Cesig Syrralic uy Ox — TS Bperd. thes Trput™ Gtlobal, | | os p= atvnny | Algovithon Por push gperation i- Void Rush ints. h-Ctop== maxs!) thes Oorplay “s “ebook te Full wrt se, 73.45 step-ar else prt, Pi Oe ena tpr 104, 03] if eee scope Tse" ¥ * 1, 5 [steps ea: | Al plgorithon Bor pur stepatte re Ctopas 2 @ Oferta “Stace, ee @ set top top! MeeNPD edteprexrT- Be] Brammglle: ox top> 4|_50 SERIES deleted —~ i Scanned with CamScanner # AP SO Rr Traversal & stnckor | seer HF ctop= 2-19 Doteploy “stack te vaderMow/erctty-” |SSESF else i OforCi=tup: tp =07 t= @orepley ects,” 1 Seep3h Garr. _ RAlgetto. for fesk sperstion jstepnth Pctop ==) Keer ry, Desay aren 8 Seale el |Step-& > else grat 93538 Ootptey “ectopy” | sere steparerT Tanplementattioy 2 stacks, @ niprtereo for fash gpetion my.” si p a rew Node fe temp Steps ir evcate Shepp pat the date ty be ented, Cosh Step-3+ Oset temp dotasx, t & gat Oct bemp—next= Na, [Step-¢ + tP- (ep ==NvLL) © set top =temp. Scanned with CamScanner Step-s) else Oset temp— next = top @sct top =temp: Seperevey. ® figerithm for Pop operation + Step eh Ctup ==nuuty then » Oviepiay © Stack Fo Empty epkh elec. sates Bho fof [20 ag O set temp =-top: i S @ sot top =tepnert - 7h e Beer temp onext = NOLL. @ cetete temp. Seer exer. © oteptog * Peta ES yt” septread’ , © eet P=top -@ vahile (CP! =o @ Aigorithen for eek gpembion Steps PCtopse nuit) then Ovieplay “stnek 8” Be ack ond tinela | separ else 1 ’ bent “4 tepid "@ vtapey “ep atcta”” Ae Scanned with CamScanner P stocks + Apphicatic F Bepice®ions ey Qstving yatey stocke el BEER! F Reed a string using loop C eteracters ore by oe} \etepoR + By using push operation, hie add choracter® of fae string ore by one* Aepsd* ey using pop qperation, We ade | one. % ‘one ‘to ansther axrvot] Coated hy | JASE Oteplay the avtoy CHI |Step-S - Exrt. , chorackr> res Sons TaPix Rosttix + Ettarbic By -tabe, Ssinebet— orb eee abo Have Ganple fbr eqn Bom BE GePic, Caprese hay on gt ar iw) ELT atb ee / aXe FU Ge Tee os > G+bec/(d-)): BD) PHd O/H brad PUL werk ANP BI Ste need tO: Reucmre the o Pd —clo td fa by 2 ERE >) rr 4 Coe) cat) xP ee dS wer yg Eon Bag ee QB sie ic +} Aten spb ee foal 2D | test ven exp. G = WA ¥ Coe at & are! Scanned with CamScanner 1 2 Blgorithnn a ly aie]: : st & MAittialirze the dincte tu be ereysty te ger Thtic ( expression. ord yeversa SREBE scan the Wen Teuerse expression From fet to vob Character by characters | | Gah the fnput character Is aight parenthesis ps then push ‘te omtv ‘the stack. ®@etse ® the input chwmeter tS Alpha numerte ‘then apperd it tothe atpib: | ‘@Detse # the input lek parenthesio “ce? ten © Pop the alt operators fiom the stock & apperd: all the opercttorS te output enti wipe parenthesis\ Encoutered. © fp the ¥"hT parenthesis “3” Prom the. a Pe etack and} discirdty it - oa © eleett Top of shack ie Riyht parenthesis rely? then push, the yinput characte onto “the Stock - O'else ier =) Orsart es te loop unt! tre stack trot em, ord input] ichoracter is oe precedence. than the top & the strok- @ kp the stack Narls apperd the? popped elementS int) She oxtpul- @Rush the Tipu Operator intv “the stack, “| Separ Sh-the end ff he fnput string 1S cereountered Yer Birrote te poop , untit the stacle is not L Rep the stack ard append the Saing input stig P the output . Scanned with CamScanner Q@EE ect GEEL OCT | @eeyoct | fost ahakere*| Slots be G@Pep pe+B* Fey pote | Tits 3 Scanned with CamScanner 4g CUES s ' | Rucue to atereo ortn ctrcture —_— baa) First oti] aly Tneertion operation” perbrms of Era only: 2 ( Airet Io Pelanye Deletion _operntiton’ perferras ot Froct oletion = OP a Ba! only , ‘ | | creertion operation’ i alee) lermon’ “a En@ueue operation’ Cor a an “Degucwe ‘peletion opersition’ ts also known operatic 0! Joc Qus wh onjicashte'S), yet coal Pow Te cramed l= ‘| vale CBypatrerear =—1 Rear idee Std yo O —a® @roauble cred 2 shen, Taurde ‘Btok 0: 3 @ tapers _& Lineny,, aneue, by Remys® Fplgscito, a, clement; fobo , SHEME i= Ber, treeitng isa orate Cit; etepa Cx & max5D, then, panges *eucue. is puaiptene Bats OAT Jagat ie quite aletntou Sx” © sek Year =veort! Ca qmas dot 4&9 coop hoe atep-a ir ExiT- ans Scanned with CamScanner Gk Algorithn for deleting 80 slerrenl Fore Queue 5 ‘hebepar 9 AP CPpat: = -i) then —— : | © visplag” ouene ts UnderPtow” Step-2 > else O vteplouy ” ‘holeting clement @CPront)”” 8 SVE Prot S ont! Step ih Cfhont 7 rear) < O Set; Proat.=reai s+ Sepu > Byatt: AT @vi. “acl” caren ee ee ea aigua gyont tb _ esteem a eee ee st See E create a 7 4 nop yae gio ctop A dnp dota. Y’ uertable- Ma ae Istep=> + aety tem dota, eek> ‘Gonp ores a er iP-CRvont SeNvlt) hen @eet Pont ctemp. © set reor=temp- “TEx Scanned with CamScanner SEP Eeinp Shap! © | etep-s else © set vear—snent =temp: ® seb rear =tempP etep-6 HEXET. ebep~! + r ee (Pron = Ho) wales So yy oda Cte play © “queue Pe > Sat |eepre ee , wit? ps Ocet temp = ne y Wek Front: = Prot next, @) set bemp erent, Worl: ae Scanned with CamScanner K chrewar queue 2 : Frnt= Rear =—) Ais A Font oF | | Bont =Gentny) 2 max A), | PEA = Coca i) 7. mmx: a7 Dhelgetcho tor Gquane gestion GY Reotig | Elenent jato . circular Qe } atep 2 (pratt iaGeart) 7 may) 6 otsployp circular Queue step-2 i+ else oe © set rear YrearFi) 7. MAK | Oect cat ear} 2ustd @ th Groat ==) . @set Pont =o - wold tneert each , te Rd OS |steparexar- Aiporttn for Dequeue operation + mie He Chront ==-)D then , at © rtopay “Greulor queue > Urdentlow® else . © cisply “deleting clement ca chonty” - @itbront: = Reecieetear) © set front =-1 (© set rear =-1 @ese @set Pront =Bront Hi) 7 mme stpsiecnr Blgerithoo Por Tinversaf of circulo Quewe lotep—t HEC Front = =-10 then © Deploy “Grower queue fy spy” -2 pele. oe > 12-CFront: Fiporble Erded gues 6 ae oes is | >The ovuble Erdect oueuedS are clacsitiea! to Oarput pesticked. Chsert ate faa ony &6, @ ontput Rectristed. Loeletion at Front se @s “0.0 @ eet Prat = = Bont) : ons CPront] data” © Cres ss-1) * @set vanso- @setr Proats Pyont—| ©0e Chont) =dorm step-Pr exert _ Scanned with CamScanner ah pelgorithen Por Deletforn ob Rear Ent Steps iP One Dorepray ee Eroply : | ASE cee | @re Crear ==Pron? | @ set Pronk =-1 Sreplay ay clement peCrearJd, ec YeQr = year | eps bey Kapptiotios & Ououss + © Online Reservations: ‘ | ehecling e mails: : 6 Prov Guewed - Scanned with CamScanner

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy