DSA Hand Written Notes by Anuj
DSA Hand Written Notes by Anuj
pe Soa > a ; Gy weal Bt Hea tor} Hy way cleminls in ascending orslo,__‘ing__issucfion mrt avi iy ofine” a hati ie ‘ise ey 4 its SRe Sah 044 wneth, _=a {| = eS void oe seta aly info) { th int Ligh td 5 A eCithe ML EC 5 aid 2) J ee ee t=B. en Somme Te dD mn ockayud|| woh ile. Lb catad dd_ Tiree) 2 40H TAIRE OL ages eat 2 Gd ono -crem gee tot t Se ste! “1 Tey? wot 7 ghyah lad fI-® Poesy Geel Deseo _Enoruy "7 pr (ise dns) Guy zoo, brs 3 ¥ Mezquugs. DARE, Sk ve zlecy eet el Br eo Pel alalulu is]34) a) )ia] Ales J Chie c is [ sf ad i) ehdofe Le] Assuring a ak 2 ase ink Taaay ef spe nfm = Finely. ue. have tsi 407 roy both Cso-a4s in aosy Cy a —tk “ byaigys aee_in auending ovd Apte =L ut) Bhs SL Cpte= L while AbtyALA ptxd: ! * Awe pte 2) Abts +4 oe Cpe = Chine | ; “gal while Bpts < m Repel skps 94 Lo. q/ Chepbi] = @ [opted 3 tes ff vow? as hte =) Bbte +1 i 4 LiCbhe= Chiat | e I 4 MM. End vio os | : | 1 Glrpe fo _moge. Suggas ARC aul aseey of inks af. Sige on 5 Lip G, Cele) = phabird — Apr = pbbr +) - wat ris Oirty > Sie s By ; ae 7 ehe a Sy ar tif x0 Echiy] / = [Ble J 7 2 Bibbs 41 at |3 7 while _Capiy Ginpk mentee eck sae nJ Ton fs ast 7 co fon stack, Pee ft Step -1- Sf (Top == =1) * ie | rink" Stucke wniaine9 | exit 4 ! a ele { Psnt “ Deleted po BA, Sltepl I HEN lop= op- 1. i Ms Exe I : | g: pe in (r+ 0 dele on cle ment in Osa nich stuck _colidh gerieve the coy a top as_on. Conga mint yord___S=bp} Cn sho nbd Top) att iialig Tops =~) (wud ee'® Sock iso nde bv ie the. ‘ f Leo ZC Deretol nor is” <2 S)Fop) » Top? Roo =! i fee jConwersion O Tuer © pers, (pas) s F/B 6 5 + ABy* f IDE . eb ABE pf — Euvauyshn pee Dos £0 : e -_/>+ ABEDE- a Prec Mo 2uerx g — Paes -/ * + ARFDE A+R ——~ * -/* MEADE yep — y¥ —/ ye VID 2 sy =z m [% 2 A Yipee Xe /OLE (O48 )k F/D- EX Jere Vo _ Yost e Ata) eB Iie LABEL ET Dt Bs = ABA & fy~eSS Pos rére Po Duna 1 ABs © 9 B/E- prays (aig) —— ¥ n i we Xe ¥ O/e- {i . xx6 —Y {i yY Dle- Yilo~= 2 i [Ts = Zé e VID- E ar) yer /D-E g \ Chie) *Ffp-e. Fr Postfix \ “expression ef _the_gven ind ~ oxprension = @ +8) *F/p-E using Shock stds Inedthed Sirigo Sennen.) + Qrace Ex pREION a C C ( | va A ¢ At a ct ct [| 2 8 Ct Ne i 3 ) ABs ¥ * AB+ I F * ABE t / Aare» | “D / pBxPxp | + = = AGI rsp) E - perer0(e Abs ereA+ @GrC~€d/g "TF EdnG) tH,IN At Ag | Ag- Ag-- | A> VIAN seal be ABC Ag-c | AG*CD RB=Cp/ Aga cp) Enea % ne~< pie ee Ab= Cp het UV (W-2)/7X Synpou Stanmed UV AWZ PAN SSRN 41 <<) he “UV# WZ Us WZ- p< Uv * Wwz-x Ove W2-\ftata a » ., [pares Taal a oe = a /Cqg-e)* § +T ¢ Spor eanve d 2 STACK = Eplressionl 0 = : / Pa C Z€ P q@ iG PQ Ay /C- Py Ro 7C2 POR. ia / pag ~ hy 4 fi a POQ~ Ga BAN PaR-S ti + PQp~Se/ £ POR-S¥/T Po r-St/T+=O: | At (Cede Ome FY GC tale 6 nc) CBE) § FIG —— i A A + + A i ¢ 7 ae Te a B aCC 5% AB + +( Gr Ab C + (C+ Agc j uO ABCt : 1G Agc+ Ce aGrcs Aect# > + (4 Q # BaCeD * + Ce Cty Agc+D? + Eon +e €} % pecs Dee "] aH ABCHDE+ L * + G+ AGC+DEF The + Caw AaceDErFe 5 Fg ABC DE A eb / a ABCHHEXP At C +/ AGC4 DE+P* + T ABC + Mea sG/tA Ta a Corp) (CeRA)/ Ge Hl @ A : A a C +( : 8 wt) AB + C+ Ae t 4x6 AR® : x(a AB9C 7 x (4+ Ct Abc D aCe (Ce ABcD a yen AacDa 1 7x ® (4¥ AR CDS 2 a a Oe ABCD +” bx x (Ca¥: ABUOKE tg a Cre Cr AROSE A x (tact ABCDYEF j E ) % C+ AGB CDE F+ a AG e Ci 0/° AG CD+EC +E 4 i * Crx/ ARCOKERG : * Agcp+Crst Jot Lea “9 cnet | i Pz ABCD + Ee +4 /erH PBcp sEF EA [exo _os SSlowe) | by +, é (ee DE ~ AGG “ttle Jp 4 as Susan ae avon a ol auk x 4 if ' al ¥*C A ! 8 #¢ AB = ¥Ce Fo 4p D x(4 Sti ABD ! | ) 5 M239 ABD* | TP Aspe | ea ee ARD+KE | = Parnes ii AgDd+ HE, 4 P a ABD E/E F zy a ees é = ARD** E/e- ¢ i Ca sa ABD» -* ElexG i -G |_—_ABD + EFA : ve Apps * E/E~Gh 7 = Ghat a POD E/E GK af. Pept x» Ef Fi 5 cs ppp E/6- Gest : nd fep sin e/Ro Gic/t— eAry “NOTA. os Not sae morc : pws > 2 (NOT OR NOT eer _OR Re SA Nore \ OR eo, Not BOTS ORAM NO NOL A War SMT Cpa VAI t ¢ “he daoel ns Sard Rab thevew) : rd Pash 8,2 a ae Pop how hoo clement (Or Push dhe desufis 1G | fushy 16,6 eS) econo gem i Ag oo ee 4 42 - ee dive Pop doo clenvns ae+ Ash vath 1Q,g 3 ‘ap htoo ck 3) shes i a ge ——Pag Delouwis(ot a) 7 yy aul Push tw ves 1S Od \a - Litwin vagalt nore O-| 3,1+ O Pot - Oe + FH AYLTIAODS a oPush goat im > Puch * 3! i fop- 9 clemendy : Ruch the geaults ¢. 2 Pasta £2 ; = foo Ho elements iu Dash Ans aauts, aig + fagh ie) il Pula 169.4 hae Poo 2 elements Pasheis sebubh Jo, 3° R 2 Pushy nd 3,2. I oF Jap 2 Clemints ” & Ba 26 Puch fre wewll 1G 16 2 + Jop_2_elermants les = 22 aS fish thr isdult (82205 acs | bh if 9 Push" WAC y eoorl =, = 7 Pop si 5A alan C= posh 19 :,jast_sut) ue yest in ipo? - calle! LILO. ; oe RRAY OMpLEMENT ve h < 7 & 8 = : AigoRITHM: - : Assuming) _is the.» te _Alrvay * imoplemanh of ped pp. Front Fg the sport Oinast” Lestin -Reay is the Test Aocation of the qyutue is the | lem tobe ingen eal fw gpune : Neo kp] 6s if Pe =e hel i Print '@ is overflows ek - j En be. 4 E Rea = —l ] Clea Front = Reo = 0 i axl else { Recor = Reowy +4 j “4 ) [Reoy J =X & ered Q: ll tone use. __deffiie) _funetp to puch elem tng Avwy _ Tglerinect Pusu. Filme” shall qrctieve the. Queue lias ime, Poon Ree "Sa on?" asgumht, 7 sg “Y Ef void Qe fash (int OFT, int Frank , ind? Recark , int ty, inf) ce it C Resse = == nl) aH i cout <<" Quawe 3s __ vere Jovd 2 : abe z = $ it C Reoy = = =D Bi {fiont Reara = ‘a else ‘i ie Reas= Reagr t ; : 4 [Reo J % : ie fish ivna alls stuf 2 4 X 6 Ril Ht 2b pp hoe Pop 2 cements et Re 6512 Puch hy dubs 2 Push i A ys)2, > ~ Pop 2 elerners. P1Qr Fes7 Pgh avy gusubls Se cS] Push 63 8 + Pop. eleropts B58 ‘Y fash thi yesu ls 8 i 2 Push AB ts fw | + Pop ke Chemayls ; S| Push tre ves 1 16 | £ Push [6 7 _ op 2 elemnts [eee a fash the gaits ML J Sse getae gees perce, fap Qelemnls 7 I fash the tult aD 2 Pop Q elemats Jade The saw' a2 aa Push QQ ar = fap 2 lems Pash Ww rail “94 8 fu BED ‘& Pu eis Bee y ee a Lg 2clemuns Dale § i Dash th vault 4,6 ; i S fush ates 7 * 1 Pop 2 clermints bowel 1 fuel thy eth ey - Pop 2 elemints aeal=ao| Fesh To awit 86,mh Deerimw Tn Area Picconitm) ele} = Yoong 4 vata | Assuming thes) epaiays _implerunte hy gy nh Leone" fort. rrosd! bb co Yon Rew is & le Dost rae} eqpvalre dora flon't 34 Exon =I Qrint “Quave bc ‘usd eile ” ot wl elge’ fore | Print“ Deleted gLFront J 1 if | bei b= Rein Ise. Front = Fant +1 end t i wk wi) warp +o cklete lent _in adingy imple merr-eol Got te veid h- Pop CA OL Lint Cron t | nt4Reor ) fo 94 Crront = 2 >t) cout << " Quewe 4 ‘role flaw mC else : t Licout cor Deletedmoe- is” “< OLfeont? * fig Cron == Lewi) Lie Bont =| Rep, + Rees & else Foot = F yont it hagProt = Reon = - 1° } veid fash Cyd)? vor fp C)s: z voi el dipley O; T AD 9] fone” definrtion af “Pach fob ard ool oid uuue '' poh (X) Lif. (owed) 9 - cout <¢ “sg Lod, elve Lig (xe 1) _ front = eon =o} “else FLOM = WOH+ Crea Js X)tout << msg fd che as & ToL if coup 5 Deleted tno 6 pep ont Ds Tine i¢ ely & fe Cit Faoht ; TCE Oa p44] font = foodie ly! 3 coup ee GLY; 3 3 Voi Gurr = AS wy 3 Cecocag Qveve Assurning C,-G is atthe. Cietu loa Oust of clze Font UO ig frorrk mart _Jotation Ress fx eda ‘location Sink = NULL? Just —> Jinke= Jest = %; i . m=firtt; cobile (oct = nute) Scout KD info j a= xin ky etch) i Linke Srac kK QDuseotion Step t:-|| = ew node + ame Qo w=? info =< Tem [x tink = Nolte gol TO = NyLL ; Tops x 4s else 1 1 Jink= Wo pan trdz | | AF fo IPsouk on cleront in Stole Chinked stack). Stouct node Lint info p's Ingle —# Minke wis at ct Yea Stas} vei void 28 Push C pale tap, int item ) SA node: #935 i KE pew der is X— Indo = item ; wx Sink = ULC? i s Decetion E ‘ ef _ Seni} rf Top = NUL u | Print “Stack 2¢ -undertfe w" | Cait ‘ { Qyv else i Print“ Dele nor is” Top —> Tnfo ‘ 319) n= Top wa) Tho = Tap = Sink or ce Ain le So) delete 2% 63 end ee= —Cispze wow) cont Z™ Stucke ty —uedefoa” I Snia ] else. Leouk 2" Detaed no: i : ti We Top) : “To p= Top p—lnk t delete 1 I. Asso Qucie. Dns e ong 7 cae X= new pode R24 > indo = itm. se robin = NULC. 82 Jf Rea = NULL Y Reat= Pront = BIS Ys oly. Reo > tink < oe east = oe eSEunetron, bong VOl dl ony fares pC jade» Fein) sok Roan) * ; {pode ye we nee “norte vidoutiee' Prter ahiy por (yu nr ml? Tn fou 29 yw dink = NUCL at C Rea = AIWL) Reon = Bont = else: § Reon > fines =a Reas = %» : r : “| Deveron | ; [Seo ts Jf Feont = NULL i jt Pind ~ que 1 undoplns exit I Ne else Point “\ Deletet po: is”; Event nfo z we front r eont = Front a bok 3 \ t oa delete oe : is HSen aus 190, & erCinadh thea 7 fe ae ¢ Front ==NULL UF couse dict awe i vif lo ue else = 4 cout us Dele her pe” Ke Form >} , oc = we front: pind Ponte”. ay) | 28) ht =Rea = Not } mye Apont = Prord> Tink’ sw Se iis fi ——____. | Write fhe bn Jon into Hindi ya “cklele cass An oT winave a py x00) Nor 6a ts _Gnsideitng jhe Gam = wile ous Ah frat Poeket ni Id. a chon addweis [of fa Ket -¥ fink « 33 A { Meket * fron 20) +R unc? “jae eet [fer NOLL)Reot= NULL; 5! wth J void embelerctackeet C12 void dlalete hcleee 0; = due ©; veid Gut m deleteprcket ©)! ol { peut id cout + 5 AB~CeD Aas a+ AG+ CHD (0 E +/ AG+Ce DE 4 - Bb - A Bx ¢¥ Ot > FE = perc « Low dh ae nes cD +P — LT Ans ll Shuct STACK { B 5A tom Pineode : a Sa Naw_P2a)* u § p S7atk a winks | Cy wold Ra Ce TOPd) bangs Snead chore Nome) c= - e eae te MIAE IS -waTORR PP g ele . a Y courde" Enter nom, 2 pinende of city" : owe state —> Pintle >> Ate > Meta n indo Pinte 2 ~2Nrfo = m + u— Sink = ntuce: if (Top = =NULL) Top = %"