0% found this document useful (0 votes)
2 views55 pages

Data Structures With C

The document discusses various data structures including elementary data types, linked lists, stacks, queues, trees, and graphs, along with their functionalities and implementations. It covers concepts such as data organization, memory allocation, and operations like insertion, deletion, and searching. Additionally, it touches on algorithm complexity and mathematical notations relevant to data structures.

Uploaded by

anishsharma5002
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)
2 views55 pages

Data Structures With C

The document discusses various data structures including elementary data types, linked lists, stacks, queues, trees, and graphs, along with their functionalities and implementations. It covers concepts such as data organization, memory allocation, and operations like insertion, deletion, and searching. Additionally, it touches on algorithm complexity and mathematical notations relevant to data structures.

Uploaded by

anishsharma5002
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
Elementary doko. oagani zation 2 Saka, of auer. prmenm As fo a Simple unit bt Values. Ooke thot con be furtcer : divided into h-Theme is called “Gvoup dota’ Oatoa Which Can be funtion. diuioed Us _culied "Blenentory date’ Se = —Dgtn.. po __________Etuntintony data Grroap a Can't be purther diuided Dobe thot ton ba. chivaldost si (eg age) “nto uth thems oe as (e.g. Put name } Retard A Collection “eb Uslnted Anion Thema, & Pile- A con ection 0) “uelatesl ernest © Entity and Entity —Ser_-_An entity aepraents a dupe ob se doko. to be 2tored , ond entities usith Stutlar ——olbuib uber {erm an ‘entity. set ! ae Sh. ongantzntion at. —daka Tate fields matords -— and filer _mnQy ——hol_be complex _enotugl tot maintaiy A ood eee, UV proak “outa ~couedHion __a{ data. — lo __Abuidy Mone complex wa —sanstheh Heys — = $otloming three — Abepe ase (nuded = © scanned with OKEN Scanner 4s Logical ox__moathernatical_descxtption=_ dohinis pe als a oii 2. Implementotion =H eee prog ail Ataasd nh 0” copukes. a fundies “Pnalyas' SO Tabla Ake rin Om Ount 1 memory needed fn Stow, ond Hime negquircel fo process the data. _DATA__STRUCTURE —S_t0gicol_pa_matiemapical modi ef 0. 4 Osxganizaton Of dato A calles! as ' Dotn Strudel The Chote ef oO Specikic data model on two main considerakons — 3 4) St mu be aich enough 4p mintos the actual swoon bie Oh Hye date an world . 2) The structure should be simol enol tot Con Ubheckivly process the data When Ce © scanned with OKEN Scanner New LINERR 7 b> Giraph. © scanned with OKEN Scanner 2. LINKED) “Lists. aout uae _ => inked eats Uy “Minen_aata —atruchure and tk ae Colle Chions Of nodes ccrch Node having two party = 1) INFO = gt Contains the value ef linked Uist 2) LINK = dt Contains the address of next node. Hence, tt ( 0 Pointer variable Shere Wa speciak Pointer Variable named START’ Wich contains _addaens of fiat node. She tive pay: +~____4 Jost Node “must contain “NULL START [ | re rs bs et Sse Sse “Nope. Premnory_nc.p 4or linked ist Linked lint WW sieouerented tn Merory throug. two — —___paroiel paroys named iNko ond’ tink INFO LINK 1 ao = 0 % eee a fe Stn (ee ‘3 10 a 6 ae aE - ae ae == 4 i See aCe eee eae 5 a ae G {20 a >| Sees os — 7 an g [30 ! Z q RE ae 10 a 1 Spec sree: ee Lee eer a ee 12 eae mt © scanned with OKEN Scanner C2=0 ols eat To] _____-Sn_Uinked Uist thease ts a bree stovage [ist = Which is ALr0 maintained by operating Aupaheon to indicat. freely available spaces fpr future use 3. STACK. a > Staus i u Wohi. ‘ aap Last: In first our (L11FO) tecthniguc, Ishere the Clement : ‘Tor’ tr a _gpeclat pointer Variable Which pointes to the hops Clement ok} A, Store. Balas ee 50 l<— Tor 4o Bo 20 | ve lo ~ STACK. 4-@UEVE . - @ueue UW linear data Struchite - St oases! on first __fn_firsk_ our (FIFO) techmigue She element fo be —luoted firot fn 4 usin 1) Hae elernente fe eee — __yivek- : a Neel neat © scanned with OKEN Scanner Shere hoo _poinkex. — varionbis named FRONT’ oul 'REAR! Wohich poinks to _the _[anat and ies short _¢eherment of _¢ FRONT queue _harpectively. x deletion 1 2-50 boy [sof 0 InserHon . + ~ GVEVE REAR She pew VOlue till be indcated from RERR May ot on ef NON- CTV) 4+ TREE dn UA Mlesarachiah iWOunADA + © scanned with OKEN Scanner __thete a _a_apeciot pointer ~ vadohte Roo olen ad oink ito Ha bimah mode = “by Haas tree Nodes Wolich OW Connected arith Orton . nodded Heroug. branthis one known a4 'Shternal neces’ and nedus Wilith One _hawing Zero” Child One “lenown ar External nodes’ or leak node 2:GRAPH. i 7. Graph Wa pon. linear abe structure, St Wa. collection Of vertices and edges haning seth: (Sop si _ Sach node 2 “cownecked sith other nodes ino grap. a 70 oe © scanned with OKEN Scanner DATA_TYPE- atti aioe = Bata type dekines —the_type— of cota uehich ta to bo stored 00 Variable... Bit sates aus tls aie D type. Derived _ Paimitive User-delingd, Agu Primary | £ Stade 3 ___ Pot Sntegs al woid i i Function $ au + Cova, chor fat: Pronk _clowble: at pis Ost. categorized into _thowe, tijeas — owner ate aie ee pork any proqiainnat og Wwe Can k wile Gnu _pToga aim . Primitiu. loka Supe. rized trko— pe eee eat ae ee ee O} Sitegeal- She _tnkegtoh dota. bype Us used fo store —________integer or character values in vantable- . Qoto spe thar Came under thin ———————____Cokeq oy Mage > a © scanned with OKEN Scanner 11) Sn: - gt UW used to skoe lakeyae. Value . $f Sineclipies— i 2 bytes oh Menor y. Exam. = int a; SP nail at ecigat ete eal Voluies St occupies & byte of : awoee 1 Mont data type aioau value of Ainge ek on. © scanned with OKEN Scanner __ i ddouble - gt wud _to ato, ‘detimab_ vouues . > __octupter © bytes of TNE OKY_ApOLe values Of double pero cision. (more 9 PxOmple- _clubte col 4 ee al ski, 09074 Si te Qantued = Shi in detived json pula tte diate, ype 0) Anrou— Aho W& 6 potlecKon sinal aa omogend oe Tyra Aypy 4k sta valent continglo ___ Odea. > Peclorotiwn ah OAD = Syntax- deka type — < arrow nave (sizes bas @xample- int ‘oll no CsI 5 Wem ory icy - wo no. <5 ae a tle Elements @f array mu no. Lol ~ 15" element s bi ig you ina. £1) =2™\ ehemmene es yeu_no- [2] = 3" element Ono [3] #4 Clemente a weno [4] 7" 5" element © scanned with OKEN Scanner No OF element - : $ eaaage aS Tae siee OF dakanype Size ef on array » Sx 2 bg te = 10 by ter > totat byter a allgeered in Memory 2o\\oe _b) Pointer — Pointer is ueed to shore mermrty (cations tok y__& pointey pola ‘tn a napmow _Ioc alfen. A_pointen _________vewioble he whenever declan 1h conlaina an aclelaeig 4 A _tpeci He bype of vast abies 2 Declowoavon of Peitter — 2 Sure Syn an- dob odbege ea LVaviable nam fees bus = Int pir; Wau ah subenent ng?) And sDereferencing CS) operat. "ecto Ragerending oparatdr ts alo known as cn dds pperaroar. dé _netyierrsa On doldiers of Hee given variables —S *Deetastag- = Defekerensing operator enkrace tee Value op — ft is Gs Niavialte A pecificd tlt Gn__askehnehs ————— a bpen ator. © scanned with OKEN Scanner Bo eg iy tbl eg. dLariig ee a= |0 ! oe nc zation oF a Choy: Aecaraton pointer, i — Sh ee pointe sa Tet \oo Boo ; *P — Vale oF a variable printed by P *CBA)— Value oF addrus af a: ailijoe OF ign- font = Wontas Lo. i Ou rt func i. A pro — modification anal finding Qhron iW eoutty Managed trough a Function sunta of Punction led oxration = = weturntype — Functtonname Larue pelt = eg. fink add Cink, tne) ; _e Funciionne Name _sPecibs er da name Oh punwton, 8 > _frguenment type species oxder of avrgwement, No- op ozguemenr ans dota type Ub each 1g ements —_——~ ine ia = CbOWe * aol ee Sg et © scanned with OKEN Scanner a UAL ad Ha Akeg x hurlers ~ Adao Hig oe easiness atk e—stalaua,— 240 3. una dened = Unser « defined dake duper are _cn _ Uses to Abele WA sequinement User dcfined — oo aka Vy pea one reared through shruckure and Union a Structure —_ Structure Ua Collection ee = ALL. hy 20s __t_ Cnn tree —O__UACA = : —-efined dara type by using structure and a. KeyWord _' struck’ ie used tp create _ - a declaration of strucrure_ se —___ Syntan = truck = tegname iy ss is aoe Member L_4 — a Member 2. $ = einer = bs | Sere {nt rll no- 5 ee char name [2°]; © scanned with OKEN Scanner E t Ploat mares Mtmory Map — S\ze Of Student dakatype = 2hyks+ 20 bytes + by 2 26 bytes. Union - ion i allection af. dia- similar data type. A_Key word 'vnion” in used dp create y defined date bype. = Synian - Union — tagname { member |; Ménber 2. 5 a Memo er n+ _€-g. = Union - Student ab Int yollno 5 Char nance. C203 5 2 7 =e © scanned with OKEN Scanner mem! _Slot_ provided ace: to the highest || byte of any member ie. har. onty linn be stored - SESS bye _Slze_0f student datatype = 20 byfer. * Csten sizeof unten ty tae ize Of tts lar gesh dake mmumber! Sect oe SE c) UGH — (lass UU Uden =depined data type St ts stutlar fo the Structure but for data security class w& more reput. Each clase hos too parts =. data member 8 member fFyottion Syntoan= Clas choss name. E c Sieh data member} 5 s: ae a _publtics sseuemmmenaae Puncton 10) + ea pest Function 20) 5 a ipa © scanned with OKEN Scanner eg. - Chass — student i a: text = — ‘ i tnt OU no 5 — ened — Bleak martes 5 = = — ed Public = = —__— — eid. “dtsplayL pb: Ink +o bal prarks 221\|26.0PERATIONS __ON DATA TRUCTURE ————— EE 4) Inserton Adding nuv data Mem tn data struchre- 2) Deletion i 5)_Trowersing ean ee en ee ierads once- = 4)_Searehing Hw 4 = : = Finding fe “tem ab” —iMpormition. on data shruchire — =< — — ase 5) _ Sorting. _- Arranging 4 Aementr of - no Structure _ titer tn an condlag— ox _duscenciing oyder for numerical valuc 0d. Prenn & fp — 2 | 2 f 0 for olphaberical value. a — © scanned with OKEN Scanner s\Merging= Grouping indiufaual date thems tne patr 3 COMPLEX TY__OF ALGORITHM = She _compterntty of an algorithm fs a. 4unchon wich _gives__—the running time and Jor space tn. terms of Thur size. dhe time and space. Ore hwo major. Measures. Of the Criclency 4 an Oigorithnn a = oor} Case = War no. of Con avis Time- Space Trade -ofF ee. Eas te. dram OF Space tor atoning He _ tio ene mon bi hie tw reduce the Hoe needed ts thee grmtessing the dab or wice-verca MATHEMATICAL NOTATIONS AND FUNCTION. — Floor SB Cotl function. = Clooy ef Gny variable : Lenotes the _qaeatert fnteges that _clotinit exceed i gh Cott efion idenoly a eas: | thian 2. a — © scanned with OKEN Scanner Date, Poge —_ * ae bi SE oor r oh ~ Cel. ie eg. a LSet sisitys b Me Py-ty do Fg : —______% Sl comes between 3 24 g0 3 ts I Mteger Gnd 4 is queakest tnreqey 7 —2)_Integerfunckfon= Suntan of dhteger function ta! INTC! e.g. — %= 3I4. and 4.74. INT( 3-14) = 3 INT (4-74) = 4 ALGORITHMIC NOTATIONS = = Algorithmic Wotatont Ore ured tn wortttting G Welt. es Ab uctirect _algoyitrn 2 A\_algorities in @ _Hinile step by step list of Problem O_Identi,ytng —Number = £ach atgoritim (a asst gned an ee —Identip-yt ng_ho. for e.g. = Aigovithm 1s -@__Conmmoenkds— Comments axe wheal to__indliicale He © scanned with OKEN Scanner alr Of Suave bradket [. for eg. = Toy first algoritton @ Variable names— Variable name will Use Capital setters. foy eg. OATR Min, MAX AVERAGE. @ Assignment Statement — Aaaighment. statement wei re ne, Colon-equtot CE ge] te orsign the voluie in variable Graignmenk operator fs Usedl. a for 6.9. — MAX 5 = 100. tit Sunny - Read 2 MAX ae Sinilavw message placed in giokakion oats and sat dito _n _Variabs may be output oy _meane ea of‘ Write” or ‘ Print "statement. : bel i Fox. eg = Waite + Syntar — Write. ____tAlyi ke © scanned with OKEN Scanner 24loilae Con TROL__STRUCTURE __ —__Contrel abructue _conbrol the Jow ye eLeCUA en ok inabrucki par wba Piogiam staat ‘ieee 3 thee ake hea. Aupen of contre stra = iz t . Sequentian Flos 1 Sequentt al Legie z Hh — 2. Conclitional How er __Splectian logic ___ -2:_Repebetiue Slow ot __Ettaation tegfe As dn Atquentiat “How, the Alrps of, CLgovitkna Ose, execubel Cnc abter the then In AoguenHal manner. 2: Sn Conditienat Holo _atistay: a. _condiHton ia gf un: Based ~ on the qiurn Conditien . the va Che | atic) Abeps ol akg oxi thins Mantle he en eciited - ———_____flste ft, Hseoe, autietien ol conditienas (lou —hsSttgie Meena. hed cota giua ser 084, — Axwe valuie the steps of IF block sith — eee be executed. a é __ + = eee Syntax S_condition ie ern _ = ees meeeere ee ereeeee eee ep) eee eee eee ea cue me Ba cee eeeseecccemes fx = St maria =8 Yo They eae fern au tenis jase t foe ieee tetruiye ject eee ceim >» = © scanned with OKEN Scanner ae F a — 2 Ccuble _Alternatiue - the given COndition tt Us trun Hen Sb block wile be At PO MeO ge TF condition thene 1 sol) Syntax- 1 —__Sikep_n © scanned with OKEN Scanner cra — 3: Muttiple _Athwmagiue ~ dh mullple @eonahiut, We Can che ple cond Hons. by Maing “Mated [b — ee coe L _ é Syntax = _T£ condition 4 Than: : oe eS rep, oe Else IF oc condition_2_Then: ee Step 2 aa aaens : oy MElee EP cont fio _'S_ Tans ib Bees Else: Ske vn Lend of Ik structure) © scanned with OKEN Scanner ex: re marks > - 60 PG eee deneeee ae vorfle : " ee urine Else, cna SSIESOT" ae i i aianeatee jiws Marks < 60 Then: z Seana = Write +! Second _dtuiaton”. Ee Of yes > = 4D andl . —_—_— marks < 50 Then ¢ — _torite +" Third diutaten’ Ho cesta Fe Ete + ate ee Cen of, dh structure) ar oe See ee ee for Atatement and end sith et Between th. _beginwing and tnd of _serpetetive plots the ho. 04 Sept ast bnouss ot * dnd of Loop” ere ase 2 stypoes Offre = —_________ Sop dhis uA 00 odin variable Such — loo, _ at K 40 __contyol the © scanned with OKEN Scanner Ex- Repeat For _K= 1 To 10 a torte +(e T= +1 them ae ~ Me — (ea Ch loop = orang wd S= end Value. Hn Chick th i k<=Re, ) Pas te emecuo bie Abakemenk f akep ys = Repeat while condition bocly op feap si sci Lena of vohte Loop J Ex- keeper Repeat while K< =|8 3 Lovite, «Ik Kr=k+) Cend of watle loop] A © scanned with OKEN Scanner TMoW2e Psyumptotic___Notation __feu _complex{hy of an algorithm ___ 1. Ria- O- notation. — Sw pey al ita + F(n) is bounde seme wutripien @1 gin) Such thar = Leon | =m 1 gényl : we Con Write th Gb E(ny) = 0 (g(n)) E order of a(n) Ar tH) © scanned with OKEN Scanner 2. omega 2 notation. = a i The omega RekAton WW usrod 2 wehen fhe _fuach'on ty tn) oe Achines a Lower bound fer dhe function f (n) = Rte} 2M | gem ain. —— tn) \ Eke > _3. UhbEa 8 netatien . : = Hk | wed the ion WW _boundef boty Hem Abeur ancl below conditiona = Conditien — sand C2 Crlgla\ [ES Fim) 2 C2 | gto] £(n) = 6 (qtol) y c2lgind, Flo algtn) litle -O- notoMen as 2 Thia_netatien Used then __F Co ana f(n) # > (gln)) - from, © scanned with OKEN Scanner ARRAY ~ length 6 of Gn array tA Calculated Cf lidthe For nina re length = UB = LB + 4 _teie, UB = Uppes bound of an aaa 2 LB = lover bound of an Arey. G-An automobile vo. utes an qaray to AUTO ty mecord the no. ok Automobiles sold enc year fom 19432 to 19 B4 - Fined — “eur the no. of atttomebiles sold tiem 1132 te 19gi. > Uete, UB= lagy gf LB = 1932 a length = 1dpu- 1952 + 1 i _ = Reguornatto tinea -arrciy in memory = Jo Find an aoldrers of Gny element to _giuen _taemory (ocotions, We Con Use= [roc (Lalkd) = Bow (At wl k= 18) | ___ Here Loc = locaton Base (LA) = Bare actarets of inear array (Nam). — lAl= [Link] words per. mendyy_CeAle ade of stamford adda, — ei be fotnd LB = [owes bound Of tn anrrou © scanned with OKEN Scanner 2gloi| 26. LSTRAVERSING OF LINEAR ARRBY. = (ng Dactins OC Cesaing earch “emia th 05 ag, Bray onse - A iin Le Cengety gel og ey eet A TRAVERSEC TAY LB UB —___hexte, LA ts lineoy ausioy tarits Lowen bound by and UB uppeu bound pd Sere 2 = Le [tnittartze. ke ib Lol Re - ie” k = 08 a : Step 3 ~ Apely process to tatk] Ceead element's vabul Sep Ser kr = kyl increment Counter vaviabli [Ena of step @: Joop] = : Steps - Exit. : : 4 INSERTION OF ELEMENT IN LINEAR ARRAY i se = en He oxtHion whee Kk < N then we heed to do dovonward f the element's ~pestttow= “Ooronwand'' ssheye to —___Wtpkien with torgen subscript -

You might also like