0% found this document useful (0 votes)
59 views114 pages

Dsfs Record

Uploaded by

Mukesh
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)
59 views114 pages

Dsfs Record

Uploaded by

Mukesh
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/ 114
423206421010) Certified that this ts bonafide Record of Practical work done by Mr. | Kiamari GANTANA SAl MADHAY fala Sruct-re4 and of WMSc(Cs) Chess in Coe ube (pes) Laboratories of AU College ds Exgiuning (A) College duving the years 8023-2034 eviments done and certified 16 Lecturer In-Charge Head of the Department Date @ scanned with OKEN Scanner unite am abgotiltun evndl prartinn..on starr abitiatl olalo. type. on ogo pram implant Vorlons opaalors_on wwrite_an clgaitfnn cond parfonn oo | _|_opewbiont of Queue: I 1 Sica unked Uist: wri iver cand Pawoeiown Cmo_polktix om g Loita con alga curd ; pape dbo fraplomerk™ fryent,, aalobe drploy troweute {twa md drowesue batk- on iE write_om alos oi 40 Lago Th Toplemantt Aenad “tree Dexationg .- . Dwaraka @ scanned with OKEN Scanner unite an algoritlon acl fo seadatext file ond cla r __| cheno | | -oatgub _hileuxigg cht chenaster to anno. Lob 8 corite. cm algorethen and of CHOUK og wis ec 7 a, 4oxt fle, woile Sorter(as into ct from FE ‘| keyfpoosd wang Cet: tite an a — PD 94, Aickionands wth dléttacul hedh fomghing vx Vasiou Ofrodions wy Te yh pat toite on lott et smplomert 180 an aa Por pakam TOA, tt Dwaraka @ scanned with OKEN Scanner ; Atm: write an algorithm amd paesom on atade absteck dato. type . Algprithen : Step 4: TF top>=A-1, psint ® sack eyiderclows “and end it: step2 2 Else top=top+t Slack Ctop]= Value, push elements into Stacie To push elements supeat | ond steps. step3: TO pop the element check whethen if top=—1, print “undarftous! ound end if cepy: er stack Ceop) is dateted top--; top elomonts will be popped and top will be deGvemunted To pop the element 2epeat 3 and y eps » Sheps: Ofiplay elemant in staus stepg: Exit ‘Dwarake @ scanned with OKEN Scanner ‘3 Page No: O2- ) ¥ inctudlecfostream> # include Using namespace std; int stack (rooJ, n=100, bop vod puhCing val) t if Cops=n-1) Gouk«" Stok Overflow" endl; else t topat 5 panto minds 5 void popC) t ff Ctope=-1) Coutec" Stack wnderfiow endl G else Cout c"the popped eloment #3 "xq Stack Fop]endt: top --; Cg 3 3 oid displays ) L FE Ctopy=0) t b courze"slack elomentt eres” Ce @ scanned with OKEN Scanner ol ~ for (ie f= bop; Tyxs0; T-—) “i Coukee Stack C1] Lo" 5 coutcende; ee lu cout <"Stack fs empty"; t 4 int maint ) i fat-ch, vol; coukce 4, push in srauk " 44 endl 5 Couk& 2, pop from stan’ ‘ond Cout 24 3, Bplay stave % endt (out & 4, exit "es endl, do Supe Enter choices" end ts cinch) switehecia) £ Coxe 4: t 7 Cout>vab Push val); bveouk; Dwaraka @ scanned with OKEN Scanner Coye 3: t dusplaycy; brear; J Coe 43 t doubZc“exi etdcondl; break} defawk; { out Fnvalid Choite’eendky 3 j while Cch} 24); ‘weturn 05 @ scanned with OKEN Scanner Page No: OS ro 1. push gone, 2~ POP From Staur 3. Ofiplay slau YW Exit Enter cheice : BE Enter ihe value to be pusted: St Enter choice; Enter the vatue +o be pushed: 43 Enter choice : a Enter fe volue to be pushed: 3 Enter chote a Enter the value to be Pushed: 65 Entey choite: zu Tre popped element is 65 Enter Choice: 3 SOLE elemenit an: Enter ehoice : 4 Exit 3 43 3 be. Al | ‘Dwaraka @ scanned with OKEN Scanner Pago No.: OG. PPren: worite om algorithm amd pregrevm on openakins of Queue. 6 Algorithm: Step: staat step: Oebde Max, fOnk=-1, and Year =-] Step3: check if the queue full Ty Queue & full then prt overflow amd erd it Stepys Elte te Queue is act full inGwement year Pointer to point Mexk empty space - > Add 7 Sept: pan tO Queue, wheve vear ix pointed , sepeat 2,4 ,5 Steps to inSevt olements in Qusue- Stepe: To dolale check element if Queue 4 empty or rot Skep#s Ly Queue 4 empty then print undertios omd end if Steps? Th Queue % not empty acces the daka where font’ Pointe) Step9: InGerrent front pointer 40 point 10 the next onaithle dato elurvent Stepiot—To dolla element’ speak 6.41% amd 4 cteps Stepi Ddplay element) tn the queue. Steph: End le @ scanned with OKEN Scanner _ te Program: ft linetude # inclade ze cltib-h> H depine mox S dking namespace sid; int queue (max), frort=-1, wear=-1; void intertCint x) £ if (ear == max-!) { Coukee* queue overflow 'endd; j else { Beart} que [rearJax; Coukéc" Etument inserted "endl; 3 5 fot deletc) { nt X; * Cesont== rear Couke" queue underflow" engt a "retcern 05 5 ele f front+ +} L=queuelfrent]; return x5 3 be @ scanned with OKEN Scanner Poge No: OF ee displaycy { “ei int is 'F Cfront == veaw { cout <"queue under Flow" endl; } we { Couk<"queue element ane: “cendQs for(#=Prontel; =e-vear; Peay Couk << qurenely] cc ", 5 int Maine) f ‘Ane opt, n; lout ce Yq Couk&K Yn Pi cout c/n 4. tasert; Gur 9, Deh"; Couk Yn 3. Diiplay"; couk- c/n a 6 nae Cou e<¥/n ===, while (1) { coukcetn\n Ener Your opinion” ; Cem opt $ Susttch Copt) L Coxe 13 Couk<” Enter the element +o be inserted *; cin>>n 5 insect(n); 2S break ; [be = @ scanned with OKEN Scanner & r yetuyn Oo core 2: nz delet () t€ Cn} =0) Couk En&" ic removed’: boreak 5 Case 3: displayl y brecuk 5 Cove HE Couk «queue exited "&endt; exit (0) ; a Duweraka @ scanned with OKEN Scanner oulpuk: Queue MENU A. Invest 2. Debut 3+ Display Ue Exit Enter your opinfon 1 Entor the eloment fo be ingertid 44 Poment inserted Enter gour opinion Enter the elemant to be foeted 4 2 Elomont- inected Enter gour opinion 4 Ents, tre etomant -jo be inserted 43 Elomant inserted Ext Youn Opinion 3 Gpaue element ore A142 43 Ent Your opinion 2 Ad & vemoved Enter Your opinion 3 queug element ane di 13 Enter your opinion ty queue exited he ‘Duarake @ scanned with OKEN Scanner Page No.: 1 A wait algae andl paaan -f teyiment nin oparatios on Single Ainked. list Algosttten : steps: Creat a node Allocate mamesy ge 0 naw cade trittolize the ced) data ound rent peinker stopp: Taek a node oak the beginning of Ha L&t Creo a new ode Set the nao nedés roxk prinlin +0 tte cwownt head o- he Us Sek the baad of tho bist to fo new node Step3: “Ewe anode at a secibic posistion - Trouebe he flenied tut upto porishon-1 neces once. Once ol ta porishin-1 nedy are tovewed allocale mromaly and the given dada dato +p the new nate. poink the noxk pointer of now mode to Fe next Of te Cusvort nee « poink the noxt poinl of Cunt node © ty Youd code - Stepy: Trawt a nede at te end of ust Creafe a nw» node SAH Hie now niodos nyxt pein to MULL Mook thyoggh the Lat untill the Last node . Dwaraka @ scanned with OKEN Scanner Page No.: {2 re See tho Lasle mocks nowk poiribiy -lo Ye nuw node - “i Peldle a ede (rom fhe beginning of the Hist + Swe jhe Cunt hood of Ust + Set fo hood of tho Litt -fo the neat nede io tho Rest * Free. the mmusmory allocated othe olaleted -nede Step @: Delete a nocle aba given potisttn - 43h the Linked List 4 empty ,-seluno NULL o Th the node 40 be dolutid into hood vede, cet te heed rods 4o the next rode ond clatte the orfgnal head vecle * Otformue , Gayle to ginnod List , tte head “node. willthe rece be ott H+ Gourd © Sok to. proutous neces snoxt porter 40 the velo cunt Aro. wath to be alilatick Hf gourd + Delete the rede is 4p be doletad - Return the head rede of “he Ginked tit. Step #2 Dotate a nede fom tho ond ef the List. Treats though the at untill the seterdl fast node sek the setondl deat nodet rad pointer fo NULL o Free the mumory oullocorted -p-the dalatid necle Step g: Didelay the Lick b. Boot Byoyh tho Uist omd porint the data eb step 5 tach node é 2a) Dwareka @ scanned with OKEN Scanner Page no.: (3 j Pacgrowm 4 # indude Lating neumespoce sid tows Note £ public: tnt infos Neda «& nek; b choy List § Nedox frat ; Nodle + dort; public: Lutey £ feast =NULL; Aost= NULLS 3 Void Craitec); void Fryeate) 3 void detstecy void cLisphayc ); Void seanch(); Lb Void Lists Creadicy { Node temp = new Node ; fine aq Cout ce" Erte, om elomnart: "ee end: CIN 5, 2 temp info=ns, b. Eemp-> next=NULL; @ scanned with OKEN Scanner r spetirst ==NULr) f finse = bernp; outs first 5 J ebe { Lait > next = temp; Aout = Fern} 3 4 Void Lists: trator Node #psev= NULL, # Cure fick; fot Count=1, pos, n; Node # teem — news Node; Coucc" Eiitiy om elomnort « Cin n, ys temp—>ingo=n 5 tem ext = NOLL 5 Couk cc" \n SIN Berean «endl; Thsert as ine \M Fleer NODE 1n o.LAcr Dore ART AND CIT NOES jn E, " int chy Erker -Youg Chote"; Cin>> ch 5 Switch coh) £ Core a; fem oext = ¢ fst = temp; Drecuc 5 Reaty Cose 2: te AME text — tem e; dats temp; { @ scanned with OKEN Scanner Page No. break Core 3: coubcctEntyy the po titkien to be inseited 5 cn pos 5 Lshile( count f= pos) § prev =Cuy Cur= Cur next; Count+-+3 3 ie Count == pos) { prev next = temp; Eemp— next =Cun; » 5 ele f Couk «Alot ablel to ingest "Zend; J vord Lists: Ook ¢ 4 f Node ye Pare e NULL} Node pus = fest; int Count =| i int chy 7 Pos; Cout ce Delete « WME FIRITNODE |n 2. LASTNODE (n 3. be Berween ARSTAND Last NOOE) \n Ente You choice =”: @ i @ scanned with OKEN Scanner r infocendt; info cerdh, be. Page No.: ein>rch) “i Sexituhcch) | toe 1? ve (Pict ]= NULL) f cout «'Deoted elument &” & fit» 3 ewe ft Coutze"Not able to dalle’ ccenclt; 3 break ; Core 2: wot Couns tort) [ prev = Con 5 Cur = Cun next; Count + +5 3 if Ceount==(){ Coutx" Delatid elamont "& Lost—> 3 abe £ coukd<*not able to olelete"Kends - 5 5 break. 5 Cose 3: Coutc “Enter the poststion of detehion cind) pos; while Cf punt! = pos) £ Prev =Cuns Dwaraka @ scanned with OKEN Scanner j he. ‘S void List>: Display? f Page No: (- ge eas wronent > a) e Lowel ++} 4 VE (courts = pat) { coutkinfo 2c" i temp = temp next ; J Coukecendt; of ‘Dwarake @ scanned with OKEN Scanner Ww [F void Licks: Geanthe) { Node # temp =fissty hile Geemp !eAULLL Post +45 if Ctemp-> infos value) { flog =U Couk ce" Clament'!Ze value 26" tt foun) a porishen"Z¢perccend( return 5} 3 3 temps temp next D iF (fog) { Coukce Element” x valuece™not fount ia the Aye" Lendl; 3 ink maainc) § suet i; P int chy tnt value, fos =0) int Flog =0) TE (eorst == NULL Couk @*Lish # empty"zeende ; return; coutce" Ett tho Value to be Jeanched: "Zeondl; cinryvolue 5 wal Dwaraka @ scanned with OKEN Scanner Pago No. re 2 re dof “4 cout 2°\n eK MENU exe (4. CREATE An LInGEer WW 3. DELETE (NH.SEARCH ANS. OIPLAY ING EXIT \n Enter Yous drotce: "ond ts Cin sch Switch (ch) { Cone 4: fcveatd s breag j Cose 2: B fogeatr; break; Cour 3: F- abel c) 5 break) Coue 4; i. SeanehC); break; ose S$: Fdiaploy(y; break; Core 6; , ; EXtting Progvome towke Frvaticl choice Yond]; brear; defautt : Coukee " Tavalid Choico" Kendly J j while (ch! =6)* tito, 0; 5 b.. cj @ scanned with OKEN Scanner » Fa. HE MENUK ds creare R ICRT 3+ pecete Y SeArct} S o1spLay 6: EXIT Ente, your ci: 7 Ent on ebemouk: SY # MENG Kye 1 OREeE Q-INSERT 3. DeteTe WSCARCY S-DWeLAy G+ EXIT Ents, your choice :2 Enta am eboment: ey Tuuk asin: L-PIRST Nove: & LAST Nove 3-TN BETWEEN FIRST AND Last Noes Ent your choice: 1 ¥E MENU EX 1. create 2 maser " O€lere Y SEARCH S pyrray & exir Page No.: 20). Duaraka @ scanned with OKEN Scanner ew [Fr Fnty your thoi@ 22. Ent, om elements 24 Tak ot int 1. FIRST NODE 2 LAST WE 3-IN BETWCEN FIRST AND LAST MODES Enter your choices 2 Se MENU EE 1. TREATE 2- Tuserr 3. pecete SEARCY 5+ OUPLAY 6: Exit Entea your choi: 2 Ente, om eloment o TY Twat a in: A-FIRST ODE AUT NOE 3+ Tw BETWEEN FIAT AND tAsT WopES Enter your chet: 3 Ente the porch to be truertad -2_ X¥ MENU *X 1. create 2. INSERT 3: OELETE 4. ceAnRcry 5. pysecay 6 EXIT Dwaraka @ scanned with OKEN Scanner Entry yous choi : 4 Entix the value to be dearched 1y Element ty os Coomd ak porishon 2 KEMENU KF 1.cReAte a. SwseeT 3 DetETE 4. -BeserAy S> DUPLAY 6+ EXT Enter your Croia. 3 delle: Ls ELRST NODE 2- LAST ope Siw BETWEEN FIRCT Arvo LAIT WoDEL EN your Choice: 1 Delatic elamant f sy ¥¥ MENUK K 1. caenre A-aceey BS OELETE 4 CEARCH ST eDiseray Gs exit EntB yous choice: 5 Floren 020 F454 24 -9JULL + MENU RK L-cReaTe a. DN SRT @ scanned with OKEN Scanner —= Fe 3s0eLeTe 4senecy 5. O1spLAy G-EXIT nb yous Choite > 6 Exiting Program Page No: 23 @ scanned with OKEN Scanner Pago No. 2 - ist re na y Atm: write am algorithm eurd psegtan 46 Conweat inbix expres to posthix exprmrton - Algorithen / Lat 4 am asilhmatic opaotion within in infix nokation - This algorithn finds tho equrivalint expan of pothibtx 'Y. Step 12Push conto stack and adel") fo the end ly Y. steps Som X prem dept to sight amd repeat 40 6 steps ech etomont of x enbill the stack e¢ empty. ghey 3; Ty om operand # entoumbered add it t Y slept: Tp om HAE porombharis is entowritijed, push if onto Statk. step 5: Th om wperatoy 14 entountiyed tum, 1) Repeatadly pop trom stack omd add to Y each operator, ushich hos tome precodona tan operator . i) Add operstor te shocie Cond if J Skep Gs Ty a ught posomtiors % enountored Hun , 1) Ropeattacly » Pop trom staue ancl odd ty. ea 2paatorunkl) « Lest Parominuiy 74 i" #) Remove the Lust i Lend of 2] SXep Et Enol be, @ scanned with OKEN Scanner ‘ tt include Mtdio-hd tbinctude < tdib- > Ht include Lto Stream -h> # clagone null Oo A depine ize 0 int top=-1; chor stack [6122]; Votd push Cohos Sym) 5 ne F903 ink itoperafor (char syen) ; ink precchor by); void maine) £ int 0, Jeo; chor inféx [size], postAx (size; chor item 5 Chan % Coukce" Enter tafix expruuscin in Parathen's “5 gets Cinktx) 5 tems inter Cie +]; Urhile ( tem J = No Df tf Cetem = "Ey f Push Citem) » 2 4 ehe iF Citem> = item 2.2) L POTTY C44] Next to tep-elomerd (i) Erecluote B operary A push B oparater A ont 4tatk . Step! Set raul = pp Stepg: End le ud Dwaraka @ scanned with OKEN Scanner Pago Ho. 31 4) " i Pavgterm i Hf intlude tk tncluds C¢math> de include tf define max = 10; Ung namespace Std 3 wnt main) ¢ dhorx $= new chay Cro]; chaos stack (rox; {nk koP=-1) opt, opr, m5 Cout “Erilen tte posthix expreiion” 5 Cindys5 int Jen= stvlen(s); for Cink i205 deny 44) T if Cisdegit( Ser) £ stau (+ ttopl= sli]; y eke { . opi Stauk Ctop-—] -0'; 0pz = stark [ top -—J-"o" ; Sositch (sc79) { casey": Sz Opr+oPss break; Coxe '-); B= OPL-op1; break; ‘Dwarake @ scanned with OKEN Scanner ES S cose! + = oprtopt 5 break; cose "5 reop2/ ops; break; Core ‘n': $= pow (oP2, OPA) 3 break 3 stork (44 top Js v+'0's a 3 oul £6" Resudle! & stark CEOPI-0 “ec endl; debtiC) $5 vero 03 @ scanned with OKEN Scanner Pan Enter the postix exprenion : L23+~ Roulk = —4 @ scanned with OKEN Scanner P ‘Afm: write, om aulgoritlwmn and paogiem Jo implement “i Verio oparakion on doubly Binzed Ust - Algaithm: Sepsr start Step2* Create stvucle pode usith ffo aand-Knaxt «2 psev pointers as moxnben fonciars tra class 10 dobine ound act gtep3: crea id Create ovr olgect ba the clos stepy: tytitalize Main om Step: write the mend tisk St2p6< Tpitialize Switd Case SKepy: Create rede “Create newneda temp = Load valuz iato temp info . Sor s= stant < TnGwmenk S$ omtill goanext is NULL “$LT- SS next = TEMP amd Temp prev = S stepg: Add at beginning a Staite=NULL podat “test creole. the Bist” ama uur O » Create node temp Sek tomp—>prevsNULL Seep 3: add ak ending o TF staab=SNvlLe paint © Perst Geol ths tist and Putten get acstat + Get 4, pnext= tevnp x femp-pnext= NULL- be. Set temp—prevey é ae ‘Dwaroke @ scanned with OKEN Scanner Pago No. P Stepyo: vatd cet posistfor nexl =] next get qonoxt = tempkteanp 7 PEYEY step: Deletion af bathieg if Slaat = NULL set qa stort load q-into 1° Seb qoper yt depir: Deletaw at begining / TE Stat next XY Helalz node temp Skepiy oisploy if Coteat' = NULL ) p auck * potting to ctisploy “amd owkces next = temp vert gary = Slat “Durnika @ scanned with OKEN Scanner Pogo No 34> 2 Bios Coumt Set Coumt= 0 Trtement Count Pine Count Stip I: Rowense se P= staat cond P2= Pineal Lohile Wop eunll Pre more Sek \=Preand Pr=Pi—>prey gE Sloat =P) Stepiat Exit Susiich Case » exit” loop epg: End les y Dwaraka @ scanned with OKEN Scanner Page No. 3S OOOO Pawgnem. 4 Include ioctensm> +f include tt include; void Countcy Void = everte); double — sist) ¢ Stoat= wuLL; 3 35 fat maind) £ tnt choice, eloment, double — Lust dt; colle) Coot Kend Lec Y_-_ - -- - —--- eendl 5 f @ scanned with OKEN Scanner oo r pute dnd| 2c opeaions on Doubly ee | dist” endl; tout endl 4" --- + ----07 vecendd Couk ee "4. Crea nede "Zeondks couted “2 Adal af beginning "econdl; cout 4° 3: Ada abl posistion " Leondl s Coukce 4 Detala”™ ecend 5 cout > elernont ; elt. dolole cement (elomont) ; Coutce endl ; wenk , Cor 5; d-cLiploy_ odie); CoukKcendt; beac ; Cme 6: A. Coumt os (oat == nL) t Cour "Lege dk empty nothing to Duwarake @ scanned with OKEN Scanner 3 be void double — 20st :: create _ Lise Crnt veto) $ been} 3 oll. wnerye ( y Coukdd endl) break y Core ey exitins del : are’ “usrong Choice “cond; J 3 ratuan 6; Struck nedexs, ¥ temp; ‘Yemp = new Caheuch node) 5 5 temp — info = value. 5 temp Spex =NULL} if Coats = ny uy Eemp—s prev =nture; 5 = temp; eke { Sestest while (9 > next S= NULL) S=e5 > NOKE 3 S poxt = = Lemp; 5 3 temp > Ppruvec; ‘Duwarake @ scanned with OKEN Scanner a double— tbat :sadd-beain Cnt veliue) t fF (staat =powve NULL temp > fnfo= value ; trp nente fasts Stab -> fouy = temp; Steak = temp; Couk<"€tomart invested Bt beginning endl 3 Voidl double. thistss add. abl (fit valuyfnt pos) £ iF (stoat = NULL) £ coukc "Fist Goats the Lit: " zeondh; 72ln 5 i strat codes temp, KY 3 int 2; ° Qe. steat 5 fer (i203 tpos-13 itt) £ VY rent 5 PEC S=NULL) ¢ cout The ane Loy tha”, <next= tmp; Emp next = NULLS tmp DPRWEYS $ ebe { tMP—next 4-9 next 5 top next> foevetmp; Yohent cto 5 tmPspsav =YyY Coutce" Elament tnusted “Kendk 3 j Void clouble - Uist ::dlalelz — element Cint volo) { Shact Node tenp, “KY; FF (Stoat— fnfo = = valuo ) s trp start; Stoat = Sot next; if Cstoot l= NULL) * Steat +>prav = NOLL Cout<<' Elona cloletnd “< end ; Area tmp); seturns 3 be. 4 =Stoat Dwaraka @ scanned with OKEN Scanner Pogo Nos Uf while (y —ynext LENULL) £ “a tmpcy nexts Y next = tmpnext; 4 Cp —prrext ENULL) © tmp 2 next BPevey 5 Coute" Element lelatiad “endl; frecCimp); veturn; “ee Cour "Element "<< volur next; Louk CE" NUOLL"LE endl; ‘Dwarake @ scanned with OKEN Scanner Page No: 42 Qo" il BF void double flat conte) { Suc nodex qe staat 5 int cnt=0} bstile (yj enue) t Veyonetys entet; Cae “ntunnber of ebemontf ars : ented endl; o double - Ltt =: swverwet 4 Struct node # pi, * Ps b= tok; O2r= pl saents Pied MenE=NOLL Pl prev = P25 while (prtenucl) £ pr>prev= pronext 5 er Pnextepi; Pl=Pr5 Pr=pr—> prey; ; tf en “ Toe roued” cc endls @ scanned with OKEN Scanner — ° ovetpat: opadkow on Ovably Unied fist 1 -Create Node 2s Add at begining 3. Add axl porablem U> Delete 5. ovaplay 6+ Bount % Payette & Quik Ente, qour Chola: 4 Enth the element : 4 operations on Doubly unked Lic 4. Greate node & Add ak beganning 3 dol bebore poristion 4 Oelate: Ss pisplary SCout 4 Revenge 8: exit Eri your chew + 4 Ents yowthe clomont = 2 Page No: 42 >| @ scanned with OKEN Scanner U a a 1. Greate nodle. 2+ Add at beginning, 8: Add aft poeishion 4: delet S: Display, 6+ counk % - Rowe & Exi€ Enlsy Youn Choices Ent ne elernoak = 3 1 Greate node 2: Add ak begining 3. AdcLalfy pPotistion 4 Delote S- Disploy 6. Count A BOUL, $ Exit Ene your cei :o Ents, the element <4 on Fret of begining | @ scanned with OKEN Scanner ‘Dwaraka iy che 2 = “ef Operations on Doubly Anke Lit ‘ 4. Crocte node 2+ Hdd oF beginteg S- Addl abtty Posutien 4 petal S: Ovsolay, 6+ cous H+ Reverse g Exile De Ents, chsia: 3 cathe elomant 25 Trak eloment aft porishim: 2 Eloment ivectid Operations ov Coubly tinted Uicst— d-Creak node. 2+ Add ax begining 3 Add off Portion 4. Oca 5: Display 6 Count Fs Peuoue & Cait Ent, your Chote -G Aluumba of elomend ee: 5 @ scanned with OKEN Scanner operckions on Doubly Ltileed Ast 4.Create. node 2. Add at begining Badd befpes pevistion 4. Detslit & Display 6+ fount Fe Revere & exit faut Ents youn choice 5 The Boubly gan Usk & t Yeah SEB LE BELL Cperake on Doubly dove Bet L. Create. rede. + Addl ok begining 3: Adel befter perrsttirn 4. pete S. Display 6. Count 4+ Revove & Quit Enter youn cheie 4 Ent, elomarke 6) diulabiton 2 3 Ehomont doalebed be Pogo No: UB Duarake @ scanned with OKEN Scanner Ps Do eeeee Operations on Doubly Lineed Uist A Create node a: Pad ot begining S- nddl off porit on U Detdlt S. Oigglauy 6+ Count A Rowente @- Quit Ent yor oie 2 The Doubly Link ust is: YD NP SEA AEANOLL Operations on Doubly Linked Uitte 4 Create node a Add at begining 3 Add aff po ersten U- Ocho C+ Disoloy 6: Count 7 Renonge § Qui Ent Your choice: List neyeyed as} ‘Dwarake @ scanned with OKEN Scanner Operation on Poubly Uneeddist 4 Create Node. 2 Add at begining 3B Add oft fosickon 4 Det S p&play 6+ Coume At Gueue & Quit Ente your Choia: S Tha doubly ging Mice i? BOS PLETED NULL opactkioy on Doulby Cinped Lat 4 Creole node a: Add ab beginiog 2. Add oy pasishion 4 Debbie 5: Disploy 6+ Coumt. A+ Reese & Quit Ents you chota: g Page No: I * r Dwaroka essen @ scanned with OKEN Scanner ~& Pago to: 44 ; ; for: unite am algorillan and program bo iroplamont binonctl Seoseh tree oparations Algorithm: epi: Stok ‘srepy: Creat aMiudhes vith into end Aagt y ug poirly step: Declore O oss BTS ond daclare membes bench'ons. Skepyy Stok a rragin tunckion amd Guo on objec 60) ators BST seep? create mones bit °° Soop cmd soitch core skepgr — Tnseation if (root <= NULL) ‘eek new node ax root ond tocol value to 7. Get ecoot Lxpt ond righ fo NULL: FE tre —y Sight = new) rede —> fafd " oamert absuady én the” paint newnede > info) re (era info > ip Ctra toht |= NULL) Repeat step 6 vith Jab amd row rode che tek Even —> dobt = naw vrode gek (tea Left) 9 bebt= new node tree lift srigk = ROLL print “node autdud 40 Let ond retwn ele ee { J) ‘Dwaraka @ scanned with OKEN Scanner \w Page No: 50. re Step#2- Step F- Step gy if tree—> refghk =NOLL repeat Step with tree —> hgh amd new wose ee fet trad sight =New node 5 tet Cree > right = Left amd tree wight) > svighk fo NULL print node added +o Pugnt and Adin . Deletion ie Ceoot == NULL) prink Stroo empty amd ndityn’. got step & vith Hem ponunk tocohton « if Clocakton = = NOLL) print “teem soeot not Fe Chocobinn > lagt) ord wight =NuLL Go to step 4 with parent amd Locohon- Qo +0 Step to with porsnt and Loa@hon - se toca 5 Jobe] = null md focasin 9 vighk- Go to Step with pount amd Locoh'oo dole. wearin Find :- if voot = NULL fet tot curd por to NULL amd velurn avd And fhe given Stafcment: xk roan The Looe node (coue-a} inher ond ako 2 Step Io! Gase-b2 ie velwrns the porent one child f ‘Dwarake @ scanned with OKEN Scanner Be rr Page No.: 5 | ( Skep is Te actu the port with two child) Steptr? Ofploy Seep 2 Te duplay -the tea 3 hierarchical monner sepia: En order : Tt daplous the eloments a) the order Logt node , rvoot node, Tigh node « skeply) — peworder > Te displays the olumen #4 the orcley woot node , at node, 208 hk ned. SEVP: — port orden : Te diiplags the olomont athe oddor Lab y Bignk amd aot» le al Dwaraka @ scanned with OKEN Scanner oo : tt tncludeciogtream> dé includeastellib > Luing nase space Std; gerutt node { fae Info ruck nodet Lobes sauck nodex soyts . ae woot} dos ost f eb uic * ; , void gid (eb, noder* , node) 5 void insert (nodo¥, nodek) 5 void dalint) 3 void Corea Cnede#, nodex) 5 void caie—b (noda®, nedex); void Cose—C( node, nodex’); wold preorcler Cnade#? 5 void inorder ( node x); void Postorder Code #) 5 noid desplay (node, fot!) 5 BsTC) £ voot= NULLS j jb be. Page No: 5 2 | wal ‘Dwaraka @ scanned with OKEN Scanner ago to: 53 Po moaind) L “~* Pint choi, NUM 5 OST bit; node # temp 5 eohile CL court —---- = "gaendh; Couk ee" operation on BST tecondl; qouk «8 = -- "eon; cout ct trie elomant” info) > x toc = woot 5 sk pos=NOLL} wekurn 5 J $F Citeme soot > tno) per = woot 9st; ee per =x00t > vights PptrSave=so0t 5 ushile( ptrj=nule) iE Citemecptr info) £ Hoc =phy spas = ptySouc 5 sretoan 5 pry Sve = pte; FE (ctemé pty info) ptr =Pty — Left ebe pts pty high be , ‘Dwarake @ scanned with OKEN Scanner % e ¥ L0C = wuULL; KPor= ply save; void &Ts: insert ( nodex Gee, nele¥ naw node )¢ i€ Gooot =uLL) f soot = now node ; yoot info =newnode > info; pook 3 bgt = NULL} spook ~ovighk= NULL} Cout <« "Rook nodes added *zeendl ; seturn 5 3 5F Ctreainfo == newonode —>info) { Coutce Element aluody én the tae" endl ; selwm 3 PE Cree info snew node info) F we FF Crea —plebt b= NULL) { insert CEree—rlabty newnode D5 3 obe { treg ket = newnods ; Cree mpt)— tebt = NULL; Crag srignt) right = NOLL; Coukze" Node added -fo Lost ‘endl; return; % lb. al ‘Dwarake @ scanned with OKEN Scanner Page No.: So rot “i if Chree awight Le nuLt) f insert (Evel —srignk 1 newnode ) 5 oe { “Ye aright = New nede; Leven sight) > Lot = MULLS baw right) rig hE=wUll} cource *ribla addod to right" dcemadls 2 vetwro 5 3 veid st: delCint Hem) { node parent, 3 tocahion; te Croot== -vight= =NuLw) bs Coe —bCporant Location) 5 of J ‘Dwarake @ scanned with OKEN Scanner Pago No: 5° rr EC wocattn> Aebt= = NULL be Location > wight b= NULL) 4 core — b Cparent, Location) 5 Hf Chocati > fot f= ULL && docatten aright Je NULL) éase_¢ ( porent Locahien) 5 free (Location) 5 J void BsTs:core_a Croclew por, nodes loc) £ fF (par == Nutt) { ‘YOOtSNOLL 4 ewe £ # (lec== por rik) posit =NULL 5 ie pox right NULLS 3 3 4 void B57: cose —p Cnedox por, nedo# £00) ¢ node * child 5 FF (doc Let = WOLD -chitdl= toc—> Lobe ; ee - chold = Loc rig ; iF (parc=NULL) "B00 = Child 5 3 ee § if oc== par —> toh) { i Por Loft = chital ; all ‘Dwaraka @ scanned with OKEN Scanner

You might also like