0% found this document useful (0 votes)
24 views10 pages

1.introduction To Data Structure

Ll
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)
24 views10 pages

1.introduction To Data Structure

Ll
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/ 10
H. J. Thim Trust's os eg THEEM COLLEGE OF ENGINEERING z= + Tatroduction te Array Date : Hon of eee AN” elements ave of the same typ: AM elements are Stored using cenh’guows memory ov int as] _, declares _an integer array oF 5 elements. Titvolige d_at th Elements. Of an array can be Intholiee e + teme of declaratter ame as] © | 1 |29 [88 Ves 7H Index —p> 0 1 ee 8 Se Cmte) ata ata ala ota) apg ald ald ala) 18) Brray lingth 3 3 into Cale 340 155163, HSE pireY fos esto) a WEB FF 5 post tndex 8 Tage of Perret 7 a 1 One Dimensional Multi - Dimen sonal Arey Arey. [singe Pimaniont L_ single [2.9 artes array es varieble: joder >) era eon qo be acess e 2 ort oly col2 cpl? col cols” Row ) — [xcaGxceag] Lacs] ~tog] 4409 Row 2 — [xratiecaca| oo |ca|xt0 *taes card Rows farameronl cacaxeoo) cae ® x (3) £5) Qow 4 |xtarcafatad 21009 wonich 16 Now or ea eee Cero nT SONI the Oe Ae a single or ene-aim- aeroy dotoryre arrayname [size] Here , dattotyr® dayne the type OF etry dong ior ext - of yarvoble ts eR dearob edements, th can foe int, cna, Ploot) io the name wont le gta which ts ei2t of the avy. The cr aad —xe the army, rua a agmr’) cep Coco nm iaa| is crtehed , be changed jn The ay — Moy ean nor Jnseve an becawe Tt 19 not soirialized- wre oi2e Pixel, th Cansh ant audent Lie); a fo gradent Ln] root numbey —— Date, | eae eee EOE One Nis 2 of array represent & store data + J * in mek¥rix Form - The oat Yor 2-9 qeroy is | leeors Variablename [rowsize | [colamnorze] | here, Varoble name represent —> ‘Vrne name of an artoy row size indicate ‘the ne. oF TowWs in table. columnsiae jndicefer no. of columns in an attay, How Yo Greate 2-0 annoy Ex- int gales Lal C12) Were = -yOUS}20 > 3 Lo 402] colwmneiae E> 1 (0 +011) Qo BOS peeuaan ea CF Arroys Random POS CF aya using array inden WSS OP fleas iyina oF code as if Greates a gingic a of Toultple elements. a J | all the elements a raters | | ais Through the ae becoma Case Wing 2 State loop. Sontios becomes easy as it can be accomplished tbs ay less kine of code, ®tsodvanta of fp | Pins CUR Cent: Srements to be entered which is dearded ok the time of declaration. “ Uniike O Moked bist an array in Cts not dynamic sca Dae aaa or OF elements ean be costty since the elements are needed Oe es managed iD Accordance with the neo Seo ottocetion. @ Pesoktons With cee inpab ® HJ. Thim Trust's, . THEEM COLLEGE OF ENGINEERING Ae Date : Wette oC pregtam fe convert _a deeimel number fo tts binary equivalent using stack, Ie include <5 tdio-h> HE include ss talib h> Ite define MAX SIZE 100 [[stak dota strucure to stoTe linawy digits Struct stack 2 int top, [/ Index for the ‘top of the stacy int _orroy [ MAX —S5287)5 bs [| Initialize a new stack Struck Stack * nawdstack C) i Struct Stack™ stack = ( struct “Stack ) moadioc C ineof Cotruct Stack) _ stock —> top = -4 5 [| set the top index ro -+ CR sceturn stack} it Chek if the State fs empty jnt is Emery Connect Groe™ stack) 5 yeu (stack —> y Reem BAe era ty [Function +9 POnieriiter vod push C struct Stack 1F C Stack, —y top > out C Gray WAot rr esac, a Yo the sYack, stack, inh X69) 9 The Shock 2 aa deaca, Cheat Or Asymptot'c, Notahons — 81g O , Omega 8 theta ae Asymetotve potatens are “the math emeh'eal notahions Used to deson'be the gunning time of an Gla-on'tnm when the input tends jowards a. paxhiewlar value oro Limiting volue . For @x- In oubble sovr, When the input ar vs ready sorted, The time Taken eee asgen! shm \'5 linear je. the best ese. But _, when the {npub army js rn deverse Cond” The algon'tnm toke the maximum _ttme Cguay =deotic) to sort the elements ire. the wort cea. Pisymptob'c anal ssis fama algorithm refers to tthe mathematica) Joundation. {framing _of_its rage =time performance, sing Gayo ptob'e Analysis we ogh very well _canclade the best case average cate s M ni « worst nano ©! 2 __Algan'thm. ecg Asymoetet'c anolasrs io \oput bound ie-,if there's Oo ingot to the ant it's Gancluded to wot jo a Constant Yime. Other than the “input” all_other Fochors Qxe mpsidered constant A He _Ana)yals refers Yo Cornputs Ane cranny, imme oF any operatren in mathematrea! units of Comp ubst on - For ex- The gunning time Aang ogerabion ts camf Pec) Gai 4 mos be For anoiner operahon st is Gompukd 03g crt) This means +e Rest operabrer running TMS will increase \ineavt with the tnevease In 9 & the running Mme UCNemeneesror oferecn WNL. imeredse ex pan entrallly when n increases. Similac, the munntna time OF is Cc inme nee recommen omccas|jmeauncs Als 0 8 tgn'heantty smal). an olgonthm falls under 3 i a For program exe Time mequired ® Best cose - minimum time required , = <= ® Prevage Care - Averogs Hime require nS ® worst com - Max” me ao 9 on the inarauerer Pence , WE est! Aisymptoh ce Notahons Breahon Time of an od ser, processoy” speed y disk whe egriciencs ef an alge s Time Function oF an alge itm is wey’ Mionere n is the inp size - iE yee oF aymeronis pototrens Oe utd to crepreeny 9 the complex! ty oF an algor'tney. Folowing — aaymng totic norkortom rn depends Pomerersicha ce thm asymprn colt werent) bs ven), gre usd 41 Colotere the ouoasiy Arime comeleni ty of an adgos Ihe O- @ ob A. - Big omege = Bg Thee Dire 0 6 ‘On oe om eg eee Tate ADT means to hide how the dperatron is petform- =cd on the dota. Tr shows easentiol joWrmebon fo “the wer. Io other othe user of an ANT needs only bo know that a sek of operokions ane ayvos lore Yor the hota type , bub ees pet need yo know how aie are ~ appiied: eee yee ae] - - — es | eee nee ae: is Stored in _ mem \ocotten (oo. Let ath ahement be akored in Memory Ustn S22 yes: a (Woon sete an eros Lower bound L220 sum Fow Upper bound UA a2 U pee? bound 0 2-3_] ~___ llecotion of C2I P= _ = > B+ Ci-u) * Cug-t2t KS +Cj-L YD XS eee loo 4+ C2-0) x (3-otl)x2 +(1-e KD = 10° a4 le t2 28 9 Clements| Oo [Oo], = )aeuk obs: fons too {62 \o4 ra Lok \\o 2 wh he WS \2o 122 jocetron of (21 £0 = Catal = Br Cyt) x Cog= tii DX St Ci -Li) x5 jot San = 100 + Cine) x C 2-041) K2t (2- O)AD = too x+6ry = 0 M5 129 }22- oo oz Toy 106 lof No Ne “Wy WE

You might also like