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

Data structure tut 2

The document discusses various operations performed on linear data structures, including traversal, insertion, deletion, searching, and sorting methods such as bubble sort and merge sort. It highlights the importance of sorting for efficient data management and retrieval, as well as the use of multi-dimensional arrays and pointers for structured data representation. Additionally, it touches on applications of records in academic and medical contexts.

Uploaded by

Rutuja Sarambale
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)
5 views

Data structure tut 2

The document discusses various operations performed on linear data structures, including traversal, insertion, deletion, searching, and sorting methods such as bubble sort and merge sort. It highlights the importance of sorting for efficient data management and retrieval, as well as the use of multi-dimensional arrays and pointers for structured data representation. Additionally, it touches on applications of records in academic and medical contexts.

Uploaded by

Rutuja Sarambale
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/ 5
“Tutorial No. 3 Empian different opetotans performed on linear treeture. Explain mn brief with exarple, ile he most common Operations performed on i linear chata Structures are:- 1) Trorsversal:- Accessing and processing each Element 'n linear Cota structure 2g Punting al elements of [1 2.21.2 Ovtpvt +: 1 ze S. TT oo eee 2> “Insertion '- Adding @ new element +o a lineg data Structure . ey Addin . lement Ss to an idfray Te dodtdt Coase Be ach sils 4 23> Deleton:= 7 eae from a near data Removing an element Structure. 2s From ify, opal 3] e©.g, Remowog 4 "2 OFChi ng : = Finding the positron of GQ element 1n_ 9 linear certo _tructure. wen, 23) Soe: eq. earching 3B im [1 Found at index 2 . Advantages sof 2 ina sorted = Tt is easier +0 find fie val West ng. Sorts 2 ascending > Sorkmg con heie minimize +ne amount of torage needed, Catenin —__ | —}+_Serting and futering date Con help you better pining two linear edetta structves into || analyze dm ts Sorting data ina sy stematre aay moves it e.g. Merging two sorted Ariqy < _ Gasser to understand £ ent Avryy 3:01, 2, 51 ie > doen 3 Ea & 6] ‘Different _metnreds of sorting ~ 3 Meged Array: C1 quick, 4, 5) eo) T] a = ra 1) Bubbie sort - Compare and Swap Adjacent lalnat is sorting? What is need sf sorting 2 bthot numbers until tre lages+ moves +s tne end. re the advantoges oF Soring ?Ivlhot are ciffomt metheds of sorting? __ 12> Selechan Sart i- Finds the smallest element and — | Sorting:- stsups /t with tne -first ,tn repeats for tre Sorting fefers te the operation of arangin fest data in some given order , euch as increasing or decreasing , with nemencal clota ot alphabeticaly 137 Metge Sort = Divides ine crray: rnto hades. boce. rls ©qch half 4 merges tn with character ete 8 4) Counting tin Count how mony tmes each Neeg of <2 ting = ae ermber appears and ctrrange them = Sorting 1s essential pe cause t helps argeni Tnsertion sort :- Pick numbers one hy One Gnd daba in a structwed manner, insert them jp dae hight Greer. |X Inlnen date is_corted , searchng for specific Clements became sch faster Compare ob 28 din un sorted cataset GA) Explan bubble sort orth an = Th compares each parr of adacent | a Ee arena end gmwops tren (f tmey cre un. sinscrted ardey y + Compare 3&2 => swap [2 eee - for bubble Sert we need to stort wit pst Atray is now Sorted lement Le. indexs 0 2 Compereiccurrend ca © lement with the mext element of #78 try 24 LAlhat ate different se, “es cheowes:?: = Tf tne current element is greater tno! tn with an _examp) next element Of Grre Swap tren. || Linear seareh'- - JE current element ic less trot tne next Tk is _a_simeu arch algantnea whee ©ach | ecteoent then Keep trat as it is and move Clement af ine list is checked seqvenbally unt! ta_next element the desired element 15 TOd o tne Wrst Ends Go tn step 1 ond repeat undil tne end of the index beached Consider an array = let us consider Gn array with value: Eves, 224 io lg so] Fase om. 45,27 > i Isle want to ch for 30 = Tteraton-L: + Sort from index O 2 Com ach elemens + Com Sha psu -[3,5, 2 ef woiln 3, + Comerae 5 29 ~=dno swop > [ 2 Bia + ne element at ing. 2p dnen Sern, + Compare # £4 = swap > [3 g.a2} stop + Compae § £2 3 swap 3.5 2,2) Larges! element F is now in its Coned pl: inary Search:- Sit dwides “tne search jntervol_m half repesteay = Tteratian-2= Hil the tower element j= found + Cornpa, £5 Sno sugp >f[3,s5 2.) eg. 2 Compare. 44 = swap Sf apy ig) ee Consider an A ray + Compare £2 Ss susp = (3, 4,2 s] Figg. ps0: yo, so} we necd to find 30 ell Whot 16 Mecescty af multi —dimensanal atre [How pointers are used m_molti-dimensional Orrays. __||= Mol tidinensiona! arrays Gre essentiol im pre. || becouse trey allow Us ty store £ manag. | tage amants of dea ino strv fa They: nein 10 maprescntng Compten: cata siucions Uke motes toblestete __|- Operations ire moth addihan. eaultipicaten and transfrmchons hecome cndre Structured and efFicient - Tiis used in ghd -based ga~wes like chess, tre— } Bese teentiete: tea vinsemeiic. pi Ae Ty wcll ae | cf panter in _mylii= dim, nal_ array |-Pesntecs provide a flexible way to ace andy || clement in mnviitdimenhonal Sr ray. [=A ccassing elements with potters i= . Consider x, | jettreranainag = Z en IL Ta, 5, 3 $3 95 494. i ~ Sal i vs eka | + Orr fs @ poi r ir if 10. sarr[i] gves a pointer go me i-th mw || on DIG) accesses indiviauel_ elements || Using panto: : panes Cora C¥Carrti) +29); _ovtpt is 6. A datebases , file sy sin ere C++ 2 pup ONSIEES SF mulizpie freids wih pide ik trad contains > Memary Aulocanen pf record: -kihen we_ store 0 record in q Computer, it ae | memory: Fach field uses space eased its_dlate type. leg. Consider rns ed For student's dato + Roll number Cinteger) — 4 byte || _+ Nome Cstrng, upte $0 Characters) —> SO bytes + Mariss Cdecimal number) — 4 bytes + Tota!_memory used i 52 byte 3> App iicatians of re card :- Academic Records - |__schoas 4 Universities Maintain tecards of Students grades and atrendonce £4: Rel no: ty Nome: xyz Class: 12th Mares : 87 Medica) Records 2182 Fe cord con Hospitals meuntein potent records for medical history & treadmen Patient 0+ P56789 Nome: x: Blood Crop Medial History : Allergy 40 penveliin

You might also like