0% found this document useful (0 votes)
34 views

Data Structure Notes Part1 Csegyan 01

Uploaded by

anonymous
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
34 views

Data Structure Notes Part1 Csegyan 01

Uploaded by

anonymous
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 25
lg intone yaa aaaaly ae ails ee ect ili a Wed, velationup +o Data ey Anything 40 give information ae vs Called dota. : - | Types of dodo Structure » Exe CAvdewtname, Avelent Rollme, There ave Mainly two type of cata Structure > Represtntetiton of data is Structure. Called ructure. [Bata vhoetre] See graph, Army, Lind. ( —_S Data Yucure > ve eens + Bada ehucuve = Dota + Viructure | + Bata Ytudore 12 Woy to ore omd oxgenize data Ao that i+ Can be used efficiently (beter way) Primitive data “Avucve > Thue ave boute Structure owl Gye directly operated by machine iwwbruct'on. kyo iwheger, Float, Chorvacter, Non- Primitive dota Aructure > These are derived From the Primitive dota Srructure. Hs Collection of Some ctype ov different type Primitive data SAvucture. Ex Arrays, Stack, trees, Bote trucure operation > “The dato which ip wered i'n our data Crucure ove proceed by Some set of opentit D Tnpertion > add o nuy deta in the data venets YW) Deleting } Remeve o Seta Prom the data stron iw Sorting > Arromye dato in increaning or decreasing order. wy) Seorching & find the Location of data in data Hrudure, Merging > Combining +e data of 440 Afferent Sorted file into oO Single Sorted file, vi) Troversing > Atcerring bach data Exactly Ont th the dato SAructure So thet Each data item 1p traversed oF Visited. Arrays © An Array Con be. Refined Of an infinite Gllect'on of homogeneous (Similar type) elemumts. + fermay ove always stowed tn Contettve Capecific) memory Location, + Army Con be Store multiele values, whith Con le referenced by a Single rine, “Type of Arrays, ee | 7 » Single Rimenrional Arrays > T+ aldo Known a One Mmentional (16) Array, + THs Une Orly One Subscriet to define ae glemumts of Ayray, | ea is Declaration > © Bota type Vorname Levenson), we Bret wn Del: Cher ¢ CS]; Lnibialiging Ont- Mimuonal Array > Boda-type vorr-nome [Eopreaion] = {volver}. Be gb mam Lie) = BA, 813,515, 6/3084, 86, Chor a fst = 4 ¥,'8,'c,'0, ey. 2D Mut Minentonal Arrays > mul dieu Preys HE moe, thin One SubSeript to deacribe the Arroyr Clemens, CILILI-— To bimeniomal Arrays > Ltd use tio peo Be Subscript, Ome Subst 40 ~repreynt vow Value oud SeCond Subseriet to reRrent Glumn value. T+ mosey vse for matrix Re preseeltiy | Beclowation 4wo- Bimasional Arrays Bota-tywe Vorname Drews] [totems] , &> od wom Eg Ea], Tritvalr'gation 2-b Arrays datodype Vorname [row Leotomay = Lveloay, Gye wom yaad £13, 45, 6b or Yak nom ENT 0) 2120357 be 3 9 4 2a. rwnle, = | wefell = 2 snonafto) 23 non) 24 non [a]eS my (2026 (8) \ 4+ tonite o program to veads Unite one Stacks (dete structure) @ Rivuadienal Array, =—— He tncludte, + Tht process O| Adding 0 new clenerd Of the top of Hack is Called PUSH operation ‘ fvery PUSH operation Top Usitremated + In Gone +he avrray rp fall omd no new ¢) Can be added ith Giled Stack fuller Stocle Overflow) Condon 2y PoP operation > +» The Process of Adlehing an element From the. top oF Sock 1p calle PoP operatiio, bby One. Top = ToP+T © Tn Gre the Army "2 full no new » Aftey Suery Pep operatton +he gia tp added . thi» Condition is eas tp decremumted, hy One, Stack Luh or tack overflow + TF +heve Bp NO Blemat on the Stock ond ee the pop 1% ferformed then ths wi) Condition. Yewlt inka Stock Underflou) ConBillion ( i ” 4 Pe ) He Algorithm fav twverting ox tem ido®| ay pop operadion » ah tacts (PUSH operadl'on) , ae oF baling on 8 pus (Stock Lorie] tem) From tht op of Slack Sp Called POP ‘ operah'on, + After Every pop operation +he step Li wiholge Stack Top ip decremented by one, pops -l Slop2! Repeot Steps 31S uti) Top < marsje-)) od ea Top = Top-! , Reod Item ~ |. TF awere is no clemmnk On the She: SU topstopet Stock amd the POP operation sips: Set Hock Tree] = item ty performed tum this will : ACK UNDERFLOW cacpe: tink “Motke oyerflow” seal troy 8 a Condition. ee ace i ea eed Tye Dut 47 YH sy3+ 9/2 * DU+ ‘o]dy3 +9]9 HAD | ayyand Sty 3 #2 # OH) wy xyrrod TO nyang oF KYM Buyenajiay et 17007 } | ov 69 TTS Fo umaun odie! 4T sypwasado Me vege UATE sh aeyouw Kner UT @waHEEON KYO eur o8 CaN TENET sre wmoun ove +E Nypuouado me aacgre, uate) gp mmanee HUE @MBNESHON KYM F jo u'e ‘eumdot OFT oxy “ypwatads b44 UBER =u) vaHAEH Hi anucds ra SE uereien PE TT -wewroren soos saaiy B20 DAML. # MOHOHON 1704S Capra orxynd ) waa 18d) cemaig arpun wes THD 75 aS, ‘ a wast 8) G2FE ON ad Hees l-dop = doe 49S eats [sox] avers = watt PS Aedes, OZ doy [UO hare Wars today vAdas Gwoty ‘Tptigenn) 1274S) dod (dog) AS, ee Crrgap 20y wytssc8iy « QR, ¥ C/O +E%F/G (® | podfive @sayeclareela — (i) Rvcine AeFIG ape cis + eel let> AEE = Ra Let AGt =A R*CIO+ Ral Ry» Clot etele Ry Cd + Ral R, x cp +6E/G Leh a [CO = Rg ver EFM = Ra R, Rat Ral revere: Ral RF Ret | Rab ie | R,¥ CD) + alta Ry * Ry + Ry | ber Col = Rs #RRy+ Ry | Ay # Ry + Ral Let # WR =Re Ri Rat Re + Ry Let Raa) = Ry + Re Ry Rix Rs t Ry Now Ener Hu value of Rs, Ry,Ry Re, Ry GiBs¥* Ry ail age Let R)Ry¥ = Re +¥+AB/co/ntE a —— Re +Ry Rs Ry t Now Ever th alec Re Ryt R, Ra Ry Aatcol® Ral t AG+CD/ ¥ alt Powrfix Expreamen of Rs Ry Re RR @ prefix om Posifix using teboler te5"! Gy Exo Gomert (At @xC) Into prefix ond pottx ving tabular Force 5 tin pretis Following onewttier 1D Reverse the tnpuk Hring » perform tabulor method! ound Pind pousin eprUAon. D Reverse +his pour: Expresion Mring Fo Find the puEPX. Prony, bxa At BHC ‘AaeR fiept to Aad Beaches 3,19 a hbo +o ty " (exe) “Tobslorr Form. Symbol Scammed «Hack —- OM Erpregnd, ¢ os Vv DED Hor a2 + f Bo ¥ So the pois Ereremion COAT. Now (Go) Revere Hus Exprerion to get the rely do prefix 's +AXBC 6 +0 Comsert poUfixd Divect perform obey form (A+ @¥6) Symbol Scommd Stace POM Fl Expreasa ( i a A ( + G = 8 Ct aa * (> Aw c (te AB } a ARCH portfix Expreaion = ABCH+ © Qyyeue 1p 0 None Primitive bintar dada sAructure. © Le ip om homogentous Collection OF clenedts, Tn which ew Elemunty are addled) a+ ove Erb Called the Rear End, amd te Exiptiing Elemunt ave deleted From other End Called the front tnd. 8 The first addedk Elertut will be the fins fobe semove from +he queue, that rs the Fehon queve tp Called (FIFO) fiyt-tn fet ouk 4ype bisd. + In queve Every invert operation Rear ig inremnded by one : Rat ond Every Releted operation Front ip incremented by one Wet A eno fel TT fe tert 20 p24 F20 ae Ce Inert 30 + dadeted Elemunt. Fresh delete 10 Qaae Fel ( belgl af te e delaked SeCond Element. Reaa fed EC} = Tae @ Operation on Gvevs @® 2) To invert an Elemmnt tr a @veve > Age grnsent | oueve [rent 2740] Sept: Initialization Step ar Repent Steps 3405 Until Step 3: Step: Rear = Rears | Seps: Set BvEveL Rear] = item Steps: Print, @veve ip overflow t 2D To Relete on Blemumt From He quene > CIRWLAR QUEVE QDELETE (aveve|mortie], Hern) @) wm aciecsne quewe is ont fin Which the stort Step Ls Repeat Hep 2404 until front >=0 of a raw blemint is done at He very Svat Step ar Sek item = QyeveL Front] Lotatiion of 4he queve if +he om levadion of queue ip fut steps: 1f front == Reor o sek Front =~! fea 2-1 Sot Rear = - fog @ Elae A Givtalanr queve overtone she problem of Front = Front +! unvtiliged Space in Linear quever sinplemnted ep: Print, No, beleteR ia, i of creyhs Stepy: Print, in, Hem Pee ee al ee oa Steps: Prick “Gueve ip EnetyO¥ » Fred alway, be Parnking to te fix Slemin. Underflous”, ms 2) Th Front = Reav se queue will be nel. D Foch sme a raw Elemuut ip threriek indo the queue the Reo ip Incremunted by One Reo = Rear +! UW) Each time an clemint is deleted from the qysene the Value of Front Up erent by ore Front = Front+) — Lnsert on tlemud in Chvtadore Quere > algo gawsenr (coueveLmms, we) Steps if (Front = = Genre!) 7: mote) | wenite quese (s overflaws fit at 7 Elves take te Valve if (fot 22-1) ea front 20 Rear = O tine Roe =(Rearst) 1 masse) [Assign valag) GueveL Rear] = Valve, lend te) Stepad fyit DELER (Bota Stacture) oReration On Aveug : eee eee Se CIF ered mmovbige = Feet Smtly weve a) Stes Hep Repent R < monte - | =1 & 3% V4 ae “4 D Read item 7“ Read 10 » ¢ f20 R20 5) sek 4,000 item fa = 10 19, 29, 39,49 Oe oo 3 a a eitleQ Feo Rz0 Rear < morte] S poe Ci (re[seT 307 04 awe, ofl 4M 98 no Ae esd ie + * pes rea wy oF Fear} we wa RzOtl Rel 3) 4tazac DELETE on Beret om Element on CirCulay qeeve - Algo > As papperecaves [om Teen) 3) tf (Brent 2-1) Write dqueve underflow amd Evi Ble: item = Queue [ front) if (Front = = Rear) Set Front c Set Reow = Elye: front 2(( front +l), wovbie) [ Erb 1 Stotemed 7 Queve CBdeda Mructure) @ Speration OY Yue (eera” ion =e Cee OS Gels] mene 3 ad R22 4) Hem Ip deleteh €21 AeA Gena.) F220 aS © \ p20 tree eo » hem 2g D1]es f>20 : them 2 20 “IPO nu, ef 18 Raud Mens: quant ey ela bart oe) Undertiow, ated Dem ip deel 20 5 | A Fea Red | Gas i) Pozo 3 2>20twe Liked list tho Linton data Mivcure, 1m which the Elements ave net dered a+ Comhiguous memory LocoH'on. A Linked Lint ip a Byrom dota Hrucure, sth. No.of nodet mn 0 bit iy not Fined cod Cogent EE Goch Blermnd Called 0 ede, Which hon two Ports. info port which amd Pointer WN port do the met stores the taformot ion Advomboges of Haked Liats 43) J) binked Liye ave dynamite, Bada Hructure Trot Vp.they Can gous ame tink downg ne Execution of a program. 2) Efficient memory V4ilizahion: Here, Memory UB not pre-alloCated. memory 1s allo Whenever ith required. And i's deallocated CRemoved) when it netonqey meecieck D Tnrertion omd deletions ave tarier Oma ef Frerent’s Tt erowste Flex g in inserting a data item at a specified Pontion cmd deletion of a data item from the given position D Mong Complex Appications Can be eoxily Cowried Guk with linked hints, Operation ON Linked Lr's4: @ The Game operation tobe performed on the hinked Lists ove D Creation = This operation are unk +o Create o Linked? Lisl, Tn tus node 12 Created om Linked 4o the Another nodke 2) Insertion £ thy operation iy vied 40 Inert a new node in the Linked List. Anew nade may be tnnertock DAL the beginning of a biwked Lint a Pt the End Of o biked Lr}, Bd the Specified! position iin a bined J 3 Deletion = Thy operation 1p vied to daebe an item (anode) From the Linked List. A node may be debede8 fren. dew! $a binked Lips z oe a pe bind Dy Specified powbion fn the Lisl -) “yy Teowerping > Tt > & preocers of going? Types a hee Saerough all He reder of 2 Uinkeh ge Eee CO pt from one tnd to +ne other Sn + Baxitally, there ave four typeof 5) Gonfatenation + Zils she process oF Linked List joining ht feted tpt tothe ST yy Stegly -Linkedl Ligt > Tt one sh Wath of ave fist Wat all nodes ave Linkad togetier tin Some Seqsential manner. 5 : ion 1 vee display = Tha open tnt Te also Called! lest sil va 40 pet yn very nodes 2 . . Ge ay dovbly c Linked List & TBS Gna in whith oll nodes ore linked fonether Py qraliple Links which help in Accemingy both the Guccester node (Next node) and predecemor snede (prewises nade) wr'thin the bist. —TWip helps to traverse He Lid tn the Ferword Sivection ond backward direction, 2 Pee may sue pre oe ee es 3 Givtulan Linked List > THE one whieh hag nro begtnrulng omd no En. A Siigly Gy) Linked bis Gam be “made 0 Givtulay linked List by Hinely Sorting +he addven, of te very Pirept rode tin the Linke Field of the Lom recke, oe) L per} LEE} eee are 4 Crear dovbly Linked List > Tt’ One whith hoa both +he Suctextor” poinler amd predecenter potrter in Cirwley manner. wa Laperting Nodes in, Unkedt Inserting of the beginning of the List Tel }+4xe1F fT Pees 2) Inserting of the 7 specified porition | he 3) Twertng om uiithin the HM > epee leat elt rai >) eon D “CL fie THe ep (wy AE peste ra LEAK! wi Inpertng A node arte Tezinniny tn inked, h Algon'tm > 4. INSERT — FrAsT (START ITEM) Lehecs fer overflow] Stept sre pty = Nutt thin print overflow) exit Else : pra = (Neder) snallocC et ‘of (Nede)) Feveate naw wade From memory ont aumign its address +0 OTR Sepa: gb PTR» INFO = Item Siepa: Se. PTR > Next = START Siepu: Sek STAAT = PTR LINKED LIsT Tnnert A Node AT THe Endl in ingly Linked Algosithm > wt @ Lpert. Lonk (START, TEM) StepL: Check For overflow Tr pir: NuLL thn overflows blae PTR= (Nobex) malloc (siseot ®), Stepay Set PTR ‘Info = Item . sega: 3 ere ea NULL , : 7e stort = NULL om thin Step! sek sTAAT = PETS ee Steps: Set lace stort. Step 6: Repeat Step # until Loc—> Net] st Step?! Set Loc = Loc~» Next Step? : Set Loc -> Next = Py (a) { = ® Leper pol qt iol] new node Linked LEST node ot +h “Specified. Position in Taserhng & M4 ingly Linke Lint. Algox'thm > Tnnert-Lotahion (START, ‘Trem, 100) Steph: Check For overflow Th ply = =Nubt the Print overflow exit cise pir = (Node #) malloc ( +t of feck) sek Pty 2 Infos ito TP stort =NuLL 4M Bek Store = PHT Sek ptr? Next Note Steps Initiale +ne Counter I cmd, Pointers su T=0 Sek temp = Stet Stepat step3t Steps: Repeat Steps 6 amd 3 until Le toc] step6: Sek denp= temp > Next Stepy; wet T= Teh } Step@: Set Phy >Next = temp >.Neot Step? sek tome > Next = PFT. = | (elt “el After Lryerhion Stott] Let Hey Hel Hels . YY the Linked a node from Ligt how three Mnstomces, - Deleting La Delebing the Firat rode of the Linked List aw Beleting the Lod node ot J the Linked Liss 3% Deleting te edie trom Specifies qd position of the Linked List

You might also like