R (0 o 3o 34 20, o Linelch F6) hu lou ony Fro, Ha) mih ho qur 3 tau 2 xequind o no touks opeuoho, 10 20 30 20,(o Engueue 0 impu qviu Huew d tou t kquirel inplenenl tkel suppo push Pop Ohy i hock ppor puah, popYtveNd duer 20 to 6, 3o 2 6 30 3 F1, R-4 2 (0 20 30, 4o Fl, R, 3 RMAk Qu Dequur F2, R4 J o l3le tnqut F-2, R 23 R MAk Ov tmpty etep spou, h stochs L with R:0 Evqut fmony iih Prvbums Qsociokd ta i naur30) 1 quAU Qlaw Gre Coompu -20 FLa) 130 qua 1o Splu ns, wr FRONT ct hu lo wuo as can mobe insed an tnud ghidt oll & oluek b uad Qu DeQurto, i t i s k lonmi pho buu, w k Crwle Qur e. Citola Quru E Jmpbankokou vwla Quru F F , RR.-1 ENQVEDE cQvCUE MAX I1EM) F0 to chulk ovenlow) 30 idPoN77 0 AND REAR MA o wih FRON 7 RE AR 1)7. MAk wu dhun o) oxh ov Ovl 6Rdu Deguau Fl b) RebuA I n wuu i Reas by ) Jr REAR (REAR 1)7. MA R 3 Engutum F:l R0 60 6o FPoNT DE AR o wPTe: Ovl ra loprdhn R- heuet D, 20 30,40, So wi Jw ik w Scd cQvEUE [PEARJ= 11EM . To chtk wlu dur d inud elnud iFRON 7 -1 oh FRONT 0 s el eenond ) SRtUA ) Rulua T(h)- 0() Ovulla Cond ilFRoN1 REAR 1)7. MAk Add dus Th) oln), r insuho inuuhe Wnh: O DEQVEDE (caUEUE [MAXT) RrtUAn 1 chuclh Uhdudlaa i FRONT7-I ffs a) wwh du la Rabuan o nunls h euM hb Ramo od Qutu) y.Rro Sel ITeM= CQUEUE F RONT) PRINT To chuk wuu dld olna i FRoN1 REAR tvs lot ebmet 4. prind FRONT+ 1) . MAk 5 AtU TRA runun! Olh)h eumeu TRAvER SALCQVEVE ( (QUeUE [MAJ) [o hal nu lo FRONT: -I, u whk U.du la 4) Ru tum 2Jniha hze a vaaio bu) Sed I 3 Repeo sh FRON7 4s MAX PPindCQUeUE( r o s 1TEM T(n) I-I +) 6-TPeinl laul elmaud dr lukd ikm) T(n) O() Cautt[T SJCHud by tne) Std aSET FRoNT be7 REMR -4 FRON7 km) ohl (I4R) k R tuau Tl)- Ofv) 03 DolL Endrd 0tbu (DEQue) J Piovty Qutut s Vomethe oue sin wd euunt Ca h be odoed moved ne b e bl n m:dd DeL Jnae e l tww tyr basvd m uriko Qu Popuk Evuy Delhe Jnul ho isor yhaic o okd ud hu o Drioviky Qgoci 2 An tUnuut will ho 6poP euwd twid priovil is dequud beon low Prony 3 Jwo cuminh hau Opexoho Inpu! Rudrckd Inse Jn Qurr is inpu peadorm delNo Deuk Yestnced inkeutio 0Peroo only tnd ie, REAR Oh is Untuit td Delek Oupud Reickd Gueu: Jn dus dalh opeuohos pun Inset o Dly ou end [F RoNT bul ingedion is UnTyit ted Dedoh qw eAvee atove Enngueu (0, loa phony duir ordu in a 5, 1) weute (0, 6, 2) trgues 1Q,0, 1) Dequue( ) s Cgurue (,20 5) Dequwve ()- lo J queU LINKED LIST A Linled Lal lLu)s tatb u no o liua dolo vocdua dkond i tok qugus umery w ouo lodh odu onhaing AL tooitg losis h noo w dalo keld &o in lwnu (hiu) d h rod Node vuc hun Doto P i d Ne Nool Sho! heod A 13a inked lgl proO Mo 2 yiuih 2 du ni dut twkos bcan1twr dy ngmil ollo Gofo con gro Ll tonbt mued & slo s require uh l Sen Mmo JAdoe nd wau mony dov w hoy dpou, b poh tu. Ba T tir lis acCausto von TART/Ke PD olays poin Thi 04 tolus do nva STaR7 p snod LL an aknal ie, od la node COn oi special velue known NOLL vOlv, indicaks d ehd LL Cpac kous o LL TNFO Mtuory kepezulehow LL Lin ud List Maik 0pexo ho LINk tos i)insel 1): o bcgh/nwid /ed i dl ) : o A 2 Auxilay Opuche Aval LasLal dul Lo): deue all tumek Coun ) ttun no uJeantk ()Jeort 0 3 lul LD--ELLrm hode roe iLL ONDERFow JTAR7 NuLL dre WRITE Dised vor kay oray Fixrd i , ie, Berf uay Cwb chad Jnekou&ou kon is VBy inku nu diol euml lowumiy Undu !low b) RedUA OVER Fto w ol uln J AVAIL NULL dhu o wRI7E Ove flou Contor imilu yp oeonau )Reun or How o cveak o nuw Net 2 Allqprehon Vsodvenkg L pou b PAva Lis 3 Rondo Accis pox bl. Nrd NULL D Hdvoo gu Avrey Ron oon Accs i o NyLL to Aode) no pok tole, Spau 1Chuc J bvelo AVAIL NULL Jhes wve 0ve flhw ) RA Avoil d Re move Fius nool Nr AVAIL 3 VeIL jUmp Se naed hw AvAIle LINk AUPIL LINL[?) AVAIL D NW (AvAIU yo@rommi Sue No AL CORITHM (Unaukion) INSLASTNODE (INFO, LINk, S7AR7 AVAI, 11EM) inin doke T o chuh ovela) AVAIL stuet Noeuhtx C8sue wwh: Ovalou Ru Nol (sbuel Nad ") mela tS7 (stvuel Nocb), Nwvo eNwhoo Cf No o * hew hode RemoRemacvei nadvo dvo:l Lsl) StNew= AVAIL 3 Avocl Jump hw Nod Conid n. blow wt Nod. AVAIL dbh hew nool Q NULL tht ,whol ate ttwko, woulU e dn output yAddik] S NEWlINEOJ = JTEM seq Urnu SVpdoh Linh P SPal-lin nl-h LIN AVAIL] uw nod StNEW lLINKJ Nu Shaullal hike P la 6 (chrck L l i iv PPIN1: STAR7 nki1i -inb S7AR1 empy NULL u c)Sl START P T()o) T(4) o) Ne b) Pkl: Suces oly ihaukd Run 3 1 L i no enmpty SPTP S7ART Repeo p whi LIN KPTRJ! NULL PTR Ump in no o ou SET PTR LINK [PT R) OVpodo Linklos nod l SlLINK[PTPJ- MEw Nod ph Ip-suaud ohilpy link! Nuu plY pdr-inl 12 ExIT plr- link: ruwnod Hos memy lin k4 eupdohd uheu a nodis eolek olod 2 l Noe Hncwd <Po ue h) i nkzd pev Cout o d link Enp shau! < p in y p ph inki voic moln ( Nodeskaul: voic insld node (Lis! lp, int ikn Noel new nodle nvw Nocu) tuwanod indy i MoLL n tw no d in n s iIp-skoud- NuLt) rwhok OP lo 20 inslas nodu (AI, 1o - 1p- l ko wi per!: NULY tvud Nod Nodu oc a inkeu Ll C d e Conio h) in Nul) ilShaud u wik a progro ds teok in cweu SioYeom. h oid hs ploy (lsd lp) olopley lA 1 Runn' Th T O) pnod i L isno op ty) LinLkeld opdehd:2 Temporon, pot udd LIN KNE ) halnocl1 Ipt ALGORITHM (Jnseehou) INS FIRS7 NoDE INFo, LIN k, 37AR7, AUAIL, 17EM) ( o theck ove dlo o i VAILewh S7AR1 NEW Print 9. Exi Proco h T Sccs tul do m Stuc NOUL CSTARTX rnod of insed Fs Noc int ih bo Mocbnk, Ovf b)ReluAn 2 Runsan da sl noc nAvAL Lid Se NEw» AVAIL 3AVA/L jUMp i ru nod Set AUA Il LINK [AVAIL 4 Ado Ihto NEW noeh Sel INFO[ NEWJ 1TE M Updal Liak o LINKTNEw NEW NOLL 6chuki ll empty) iTAR7 NuLL hus aS7AP1-NEW 6) Rtuam T): 04) Nad Nodshad; Void shsl nodsLid p,idem) Nool nuwn od nuw Nocu; ntwnod den ino= ilkw n u nocl ink = NUL id p skad NULL) p-slaut YdUA hiw hod ntwnod lnk= Ip-a skaudkak nuwnod -D (vcoa n nacl Velukon odd ik nwncob JNDnuwncd LJ:STAR7 Updok ink updo STAR S N Alordm elha) VEL FIRST NODE (INFO, LIN, START) uhro luwy is volid whn LL o STAR7 iel o nunoo iTART: NULL He o) we UnduPLo" Y, SMRT ik) ) STAR1.inb ntwnod, o START) START= ne nol , STARt d Jnsu S7ART new To thu urduPlaw) nod T(h)-ol) 2 ewhodu (, S7ARt inl CIiho lize a po ku) Sc pyS7ART START jump o hud nod NoDE al eny Posiho Sal S7ART LINK[sTART) 4 delh ixl Noo] - DELETE )L[R L[P) 5 Exi 2) L[P Runni N pe- link- nw nol (, py li.b * Jhaud o nod au wn pos hon oPty inu Pbr h) - O0) tL pdoks 0 4emp tooy pointeus b du st nod hon ll- O cCool void dlhsB nod (Lst ilpn Stul NuLu) Cot Unlul w Nool pr pau pahaul= ph lu Coul ce h Delkd iln SSAVE pr mpiu Moo) SSAVE=phr PTR is <ephy i 6 obkh per 7 CUpdok Debk Sot phr pt Sov ilLINK[STAp1]- NuLL h 4Link upcl oes 4Teaf pY Vod dlLasl nool Lat lp S7ART STAR 7 NULL (Stod- NUL Coul e mo dho l On lulow no &So SAVE TAR S PTP LINSTART 4-[Rrpecl zhrp 5&6 Ponnn tihat: T(n) - Ol ) CCocle cDelh PTR Co toi PTR Exid 2J8 h bd lat co tois Ang rod aSel PTR lal nodu DELETE ewRI7E: 'U.dulla 3J4 Ll "lal nodJ Sel LinGAVEJ- NULL DELLASTNODE INFO, LINK, STAR7 1 To chuh undu lw) ilS7AR7 NULL h S naoe pTR LIN [eTe] ALGORITHM Debko) b) LPTR Unp whb prrhurlp LINKCBTJ4 NULLnS i (Ip- haulk NU) Nodphr-lhaud; p- sa KULL deleh p, ttu NooluSove Ip-sal NoclphY- Ip->skub lnu; twh: phlak !NuL) Sove- ph 12 wh o alao o Counl ho o nocdu h Ll inl CountLisk lp) ipslaud- Nutu) pYph Sove k e in NULL Cou0; Nodptrtad Ip-shau ule ph whi (phr-doad pdy- p Del Nod ol ony - NULL) link Th)-ol) Cound ++ posrkou Tn)-Oln) 2 Liuk pdlo1 Hemp py &WAP b display ikm Void d's ploy lul lp) i o A p+slaud - NuL LA-E Cout <No iknd Nod ll plr= &te lp&lad uwh: pt ! Nu) loul e Jno pl phli < ptr- i lo<e l OWAP 2eavd or ou i Voic s t c (list le, int p~ sta whi (phr1= NoLu) iLl i l lpBr- info rr ) NULU) pBr- phr- au, CoulNotFound (LL tmpty Cout Nool tphr -Ip-sut ih lount- D wh: QFill op (plr!= NULL) int beelCol ee J int Vd tou ipshu Nuu) Coul L l s mpty 0 Noolphrs tasl 0 no o nods dy L struc Nod.*p- d bp in C-O C)pb whi P ) p- l p lin l ) qiun ik tq m ty (Lisl lp, inx) ih toun to! ollt n found H bgutny rtu blork wit do ophou Couh beok Ydun ptY pd- hk; wAr Count Tu bolowit o k unt h Coun+ CouteeJk heq utu L O J obve n oue is d Do (9vul nocd spl (p) Yoan + Polp-hb wlu 0 a A-B 3 A ol 3C) bCc) Do (NoLL) Coed Qwhd will b h etr int C-0; D-D- voi touhl &hul hocs p) (B) C-3 tl 5 no lul) Ashued hoob p, il + Coukt Iplinb) louin -- 2 Void amo u AB i l (pP) ls qll (NULL) (l Pr ls; ! bsl-nod - 21M3.657 lisdnxt duap r-vol, qvol h.Llak. h 4)P Vo ic vh u P-hext P-lihL d!p-ta Y NULL 4- P' p-hert:0 1 0-Consieu &u aloaiay ) LL Po nad p birs LTE-D-CETE- gNULL 2 Cuhol woud whil (a) /p atRt Cokou equenu n s l YNuLL Stwc nocl *p LR - P p-lin - , P:75/gN MEr 4 YVE P FivslluLlah; DA P-in Pritl ink Fiul b G proho whad int C-0 125 Coyd will b hu tp Lsl qll d sllotuly propvon void touhl &hul od *p) AB i l (pe) 2 Void aou (sducd rok s) (BO) lovt Ip linb Q-Tu lgui rpuk c3 dhue P: lis revek a dinol, lihed hs dm lis nx duuap r- vo, 99vol) P-9- hea 9-P phexl o NULL 0-Consiolu Alauiky LL veh u PO) nad p fisd f NULL LE-EEC-TE-O 1 2 y uhol woud whil Ca) Q P p 2143657 tua (wutL) d!pv oic hool "p, i sl-nod po q- l equnu nsls RLL P ivsd lik; 5 - , ) P. 75/gN MEY4 /p D liubliak, P-inL ik in k Fiul k nstak lnk P lk tktCuhou Llot Q Cons du hlew Dole Fil Guoy Np.lea t How mon, ik puohou 6 ev opePesBei Jnut whol olP olp ol tk tw Nov Klay iwnd p hsi, whiu p!-) Pid P- LtnbLP); dalo (3) od PonsT 1 QCons ku lewn LL 2 void bo (Shvucd ady p 2 Phin Phint p dolo shu Alod Adole prd p dok), ADC) A) )ADCC BA (C) () Devk kelds oa updoledperorn ollasiy L Md 2 E 27 135 TREES Jisa noh-liua DS J b veuohl powuh lon lveos dhel DS or uked tpvestnd doo Roo Level o Leve't B CD // ordu Nod Lrurl 2 E F G I J /I te Levdl3 LM hui rolichas om tu Tteane Leaf Nad eunuu is no impo tan Basic Te mi no lopies )Ro Noel wih no pau t y O pon eund do chld ti)Leo Node Nol wil no hld Degk hods ch:ld # biT De r u o tree ibhups vi) An Coso MoHwun desu o noe i o Qive e (hldun o on nod 1s tris a ch pod o poatud anusor Rost pod o nool Q il P appoat A,C,J, an CesoY o M vir) Descen dond Nocl s é MN a Colud d dhu aedot e du Cadou oC y Level: ) h& o all edus oe pao Nocle Lenal e podu MejoLl NocllenplL o pe xi Depdh o hu ive dplh do Yot ho Clopihto ho . u uw ed dogl hmo decpas! o naole Moyi mu duph Omoy ol i) ighl Tru: Moxmum heie L xi Si2r, o nodo duandon! intudh tvey nockhs bn 1) Com plk Bhay Tau d el On wel ,2,. d-2, has hecl, 2 cbeld Al luof nod uvel dld-1 nad oo ilall th: ld Ce(cpt leo rodo A d- A Sk Sww Saw i) Fu Bnay u A BT Co lud full B7 cac hoch Tru D Si23)3 S17Cc)-2 two ch ld A allue du Sze (P): is binasy tru Call i o t no ho 0,1 O2 A Foll 1 chtd p ly duIs alo inory e e binay ru (7) Vol A Compuk B7 ha &oc don wel A Sih ayru ree Jnve ld Vold Full B7 vcl, 97 0 Co puh 137 but Lonve Jhvolicd nc no .) ncly Bivuy A8T 1s 143 hu Q Find NDe(D) i rois o tolld nuly B7eacd ad ha exort 2 chld or no oMild NDEX (O] 10 Volied C Jvolid A AA isodueu heyWas A AU Ful BT Reprosetokon Bicty B7 b i onve Me Lkud Lisl Repretuokou shud Nod AR nad ot Noodl, vghf inb Bina, ru Mnmor Para, Repcz euro ho Nol7 HNULL Plr: nl HNo NULL PY n- D Q Fnd u 6 Rool 2 34S 6 ol 0 2 3 s6? Roo o faund t): ih 6 no ohll p o qves re #NULL P # Nocl 8 No NULL phr ? NULL plr Not Null phv Lll ch:) 2 Riahl. chil ()- 24i+1 h+ n1 hnod C us t1_vy noe ol bw no etaugsl? -JI . a h>o noos l ha is in Mar no o Nocl Ot hiahi M J un min no nals 2 QConsicdu u llaw nod mo B7, Fud d. Nu M 1 A Bend -3 2 Null BrOn (L»6 Rele hona h(MO 2h o o i deoru noade ,h, 2- i3hin Royd url nM)moy -1 6 3-1-2 B- h, +2xh, )3-6-1S hh t Raugiv n( nox -1 d-o ,Rrwsg Sol nlor n(H-) i3 hMH> Minimuh no nodles a luigh h J Rois o l 0 is uve Hnymi) logaT&VIn-I Loe, (n)-1 sHn-1 node is H-0 g 3 3 a 87, hod o dgu no h() miL M> log, (n-i) -1 oinunal hod o duei 1is AA++h nMnHel Msn- loyn,: l0 o, ne ogfnadi isS a lv hluy Yeveue voNd CDUl_Rvew () cirtda dal, sd DNool t Htad- Ph»k hi ll elt t th (t! Kocd) ctNUL Suwop (tlh., (-P)»), No Counl CUmeul 1 uhol doe du tunt do on Sovkd CLL o Jnel dupbtd 1) Jrotil duplcoh ol oltneh ploc Rmou duptto Rmus inkeld updekd Swap (MadLliuk,uod-RliL) uod od-Riak, nit CLL in OpvokeBeg|nd Mid Jneul Heod Deu 3 5 Voully lihd lisl (ouu) 715 QCorsdua unthio do hove Ctl wih hugd hode oid Po hue Node eod) s u Ned tuuuk: Kdho nodn whi uMenl rud! Head) (CUmuldolo tomud hud --dok ne nnl tuuud nrgl-> ntd Cunuedud = nr x 3 weld opodok in DL Opeuohio Beehd Jrou 3 De vn Md 3 2 2 (J LL tohes &ivy ehenund START- LINTART] aSTAR7 NULL Sel pdr PTPSTAR LINK[S TAR 17 wh TRA VERSAL-CLL (LINK, INFO, STA RT) NULL d nodus et SAVE START S Alapslh(Treval d START 5) Rtuxn 3Fror mulk 133 LINK[P7R) !: S7AR1) ShVE LINk SUE) PTR LINk (PTP) LINK (SAVEJ: START; 4. [D. leh PTR) START whip Prin n STRRT) pt INFo prph ink oCosl nod] Pnl pt i o Tint n) Ronni O(n) i) Delh: P7 Con den Bllowi SExi Runniy CLL 1T 8, whet das natT6) Of-) ts poik b li nec. x HLinl updoky , elwuul > eUnus id Find (Gvuct S, inl a uhil (s-de)= L) Nos S-Shnk ildelb YUN retuA NOTA 13 275 chud br i TART NULL a TAR7 NEW d i INK[STAR1J= START 4u START NULL 3For nml kp nad LINWNE w): S7AR7 S S-il Ll no my'yJ Sel PTR Sel PTR SHAAT LINk STAR7 START, SeSove :LIN [STBR7 whiu P7R != S7BR1) whiu ( L/Nk [SAUEJ! STAR7) ptY PTR: LINK [PT]; } SAVE LINu[SAVEJ; LIN KNEw) S7AR7 INk [PTr] New 6 E Runni BApl nad a Sed STA R72 LINk [PTR Se SpvE LINk (SAvtJ STAR7 = yDelh Tina ThOn) Deuh : P7R Sbxit l i s na nphy LL i AlGondhn (Delke.) mpy Ronniy i Li On) ield updoks = 0 DELBEC CLU (INFO, Lintk, STA RT JTo Chu Urdu Plow STAR 7= NVLL u e) Lwnh Rdunn Udlu Pla tt hos o L hes OELEND-CLL (INFO LINk, START) 1o chutk Undun elo i STAR1 NULL A a) lwxD.de a. b)Ex hoc Civulon Lialad Ld (cu Shau SJ LL al Cmpky) Sel ply ART LINK[STAR1) p r LINK CpvJ 5 AlowthUnsenka) NSFIRS7 NODE. CLL(INFO, LIN STAR, AVAIL, ITEM JTo chuk ovu law iAUAL- NDIL Hu a) pid Ove dls 2 Runucv Yetuxh AVAIL AVAIl LINK [AUAILJ 3Acd Ik o nuw ne) INFO LwnalF 1TEM is emphy) Ll iSTAR 1 = NULL a s o C-EXIT i Konn T(n). 4Link pdots nodro Qvail ls0 o Ew nodls 4.1 LINKnew noc=STRRT STAR7 hewnoo LINLpdr ntwhod S START NEW b) Sel LINuNEW]-STe RT cEXIT 1, , INSLAST NODE- CLL Co), n) LL is LL is (INFO, LINIk, ephy onpy S7AR T, 1 To chuk ovdlaul iAVAIL NULL dhuu ow. 0vuleu bAueuAn 2Remave noo YO AVAIL Lis) Sed NEW AvRIL Sed ALAIL tuart LINK[AVAIL a 3Add kn] SINFONEW) TEM AUAIL 17EM Ciol Db.l, Linle d ly CcoLu Linkely vyolok i DCLL Opeekou Mid dnen Deluho 2 2