0% found this document useful (0 votes)
30 views56 pages

DocScanner Oct 5, 2023 4-14 PM

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)
30 views56 pages

DocScanner Oct 5, 2023 4-14 PM

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/ 56
SSS i pata Structures Using *C (22317) i : am to sort paerraeays Practical No. 6: Progr an array using insertion-sort Practical Significance: ration on specific data element, the data has t P a > 10 be sorted tem requires following a Sorting method. One of the .rtion Sort for sorting data from the given list. ; In order to perform some ope! in data collection; and the sys most commonly'used methods is Inse Relevant Program Outcomes (POs) * D edge of basic mathematics, sciences and ‘basic related problems. Technology knowledge to solve broad- I * Basic knowledge: Apply know! engineering to solve the computer group « Discipline knowledge: Apply Information based Information Technology related problems. « Experiments and practice: Plan to perform ¢xper” EXP ie to golve the computer group related problems. . ‘omputer programming-/ technologies and « Engineering tools: Apply relevant C tools with an understanding of the limitations. i © Communication: Communicate effectively in oral and written form. iments and practices to use the 11, Competency and Practical skills Gs fang £ This practical expects to develop the following skills in the student. programs to solve computer group related problems. draw flow chart for Insertion sort. Develop 'C' ‘pug and execute ‘C’ program for Insertion sort. 1. Write algorithm and 2. Write / Compile / De Relevant Gourse Outcome(s) AV. ‘Apply different searching and sorting techniques, Vv. Practical Outcome (PrOs) implement a “C’ program to soft an array using Insertion Sort method. Relevant Affective domain related Outcome(s) 1. Follow safety measures. 2. Followethical practices. VI. “Minimum Theoretical Backgrgund ay Insertion Sort is @ simplest data Sorting algorithm which sorts the atray élements-by shifting elements one by one and, inserting each element’ into its proper position. Consider we sort playing cards in our hands. Vi Maharashira State Board of Technical Education Be) Data Structures Using ‘C’ (22317) vii. Insertion Sort Execution ee Bmw 10] (11 me 6) 03) 0s) coo oo | ‘saeco Gy ao [of fT Home Home Bbw e Algorithm: Step | Repeat step 2. to5 fovial ton step2.- steps 3 stepa %- step 5 step 6. ° sek key calil; seb yc i-ly Repeat while soo and key < oli] set a[jttJ “ ! DECAD FA eri wists Ceti! ot “ 4 wd éftiino +# bp yt i th AMdittoe Iotid 21 Nore iT Sire c —— > Citi JT : i. S jo. } t ra C++ ’ yj)‘ ttt ASL, cot = « < Lope oii oat > ' 7 J {itp =F i¢ity ‘inj => Pigeon a MI Sa 7 powchart: 7 i C Program Code: hare State Board of Technical Education a es OTT XL Resources required Quantity [ Reman Name of specification ; af C ; = coferable> Hanhemc Computer (3-15 ep oad Computer RAM minimum 2 agpét Batch ~— System onwards ASB as at . - ier 6 | |_| Operating system Window Ox ereion 5.0 nls 2 1 or Later VersioN__—=5 5 | |_| Software Turbo C/C++ Version 3» | Later Version XII. Precautions Lae Ider. 1. Save the program in specific directory / fo! “2. Follow safety practices. faa \ ‘XIII. Resources used ‘Name of Resource ‘Computer System with broad specifications Software - f | Turbo G —»—_-»—______ Any other resource used \ ; | Conchus''o XIV. Results (Output of ‘Re Program) F470... 0.0.,3.02. XVI. Practical Related Questions i: Note: Below given are few sam fe y fw sample questions for i more such questions so as to ensure the sthileno fae nt 3 fle , 1. Define insertion sort? faharashtra State Board of Technical Education - a dmbex|.@ Of. comparison..aie. CNL). Choose the right option from the following:- 3. Insertion sort is 1 in-place 2.out-place 3.stable 4.non-stable a.l and 3 b.1 and 46,2 and 3 4.2 and 4 Ans:_{\ 4. Sorting of playing cards is an example of a. Bubble sort b. Insertion sort c. Selection Ans:_( I sort d. Quick sort a3 S0n.£ S Maharashtra State Board of Technical Eilication ; for....given.....luist Data Structures U: ; sort : 5. Total number of comparisons for insertion , a.n(n-1)/2 be n(nt1)/2 ee a cn din‘n Ans: XVI. Exercise pe sara ; oe 1 Find the number of comparisons required in Insertion Sort of the following give, list having 5 numbers. 1 0 2 3 4 Pap Pye Te 2. Sort the given array in ascending order using Imertion Sort method and show diagrammatic representation of every iteration of for loop. o 1 PTE " 3.What, is the output of insertion sort after the 2nd iteration given the following sequence’ of numbers: 73 519846" ‘© (space for answers) Paras.on.. a4 eet ESSTRLET - 1000] |300| 140] 50 eee [ao [Se] [ete T4o[3ecTicce] Tse ] 1 J[-ze] 50 | 140 [300] tooo], | Ta Ts 1s rye 7] 1s is Ts ale Tas Ts Ta 73 [5 [1 TalvTal¢ mss 3 ey] rp [51713 a [4]ej Tats a 1S (pees rp Pet Le} ‘Youtube, = ai tackoverflow com (ee Y~OX rorw ies £2 8 on 1801018 N2Jqb8S9s-(as on 19/01/2018) 18/01/2018) iis : tips://Awww, ! “Becks forgecks.org/insertion-sort/ -ony/data- in ‘-structure/c-insertion:sort (as on Assessment Scheme Performance indicators 5 Process related(10 Marks) ‘Weightage ebugging ability a0% 2 Follow ethical practices, : “10% Product related (15 Marks) 70% 3 | Correctness of algorithm’ 15% 4 | Correctness of Program codes ae 5 Quality of input/output messaging and output 25% ~ | formatting i "6 | Timely Submission of report ° 3% 1 to sample questions 7 Answe! ip! 100% Total. (25 Marks) ee 25 Marks) bers List of Students /Team Mem Dated signature of Teacher process Related(! nL. im. VIL VIL. perfor™ mm given data list bag Sei No. 7% ta items £0 ae ae tack is a data ameuise- SO Stack is a data sing,” erations from one end. lug practic# an significane®? Practic’ to perform inst eer suit es ) rand pe rms these FO or (pos) ig: mathematics f ba Apply knowles prel ried proviems: Technolosy knowledge 10 solve broag ‘the compuler BPO" information plems- nee experiments and practices to use th ¢ Apply fology’related. PO tice: Plan to Perret jet group related problems: int Computer PIS! elevant Com if the Jimitations. oral and written form. ively in In ordet Last in First out that follows the L m Outcomes scienees and basie Relevant Progr owledge? gto solve owledget Basic, kn engineerin Discipline kn based Information Tee Experiments and Pra’ results to solve the computer Engineering tools: “Apply © tools with an understanding © Communication: Communicate effecti Competency and Prat This practical expects to devel ramming / technologies ang ni . . .etical skills . op the following skills in the student. ter group related problems. shart of stack for push and pop operations, programs to solve compu Develop 'C* d |. Write algorithm and draw flow 2. -Compile/Debug/Save the ‘C’ program. Rélevant Course Outcome(s) k and queue using array representation «Implement basic operations on stacl Practical Outcome (POs) rite *C’ program to perform PUSH and POP operations on Relevant Affectivedomain related Outcome(s) wares 1. Follow ethical practices. , Minima pia Theoretical Background is a container of data i a items that are inserted ' is and removi ed according to tk Iast-in first-ou -out (LIFO) princi of element principle, A of clement ean only be done fom stack has'a restriction that j called PUSH a at top position only one end of st that insertion and delel® delton sealed pop, "? MH Re and we call that posit \ ry stack. Inserti e 5 d ion of elemett Data Structures Using ‘C™ (22317) yur. Algorithm JUSD_ Step 1 1-"Hf top = max! ap p Step 2 :- set top =topt tia steps: set stack [op] = Yall Step4 -ENd fee ; Step If top = Null :--! then d. if. skepr*- set value “stack Lt?) steps . set top = top-! Ste De he * i Pp. End ; }staks is full end if rv i : prinil stack isemply us © IX. Flowchart aN f Cisf DS — ae Ops is WI stacle Ptop] =) data. | Stack t's | | “Fa iia Eo ‘Maharashtra State Board of Technical Education pee ee oa : AW Yay | i if Cope!) avetum A 4 — : wturn stack [tops = Int pop C). 2a | jo stack a Scant (“fa 4n): ee ay ; ne printf f£t Va 2 Remove. an element”) i puintl. peey a 3 Display thes task )s— ce \ in 4. Exits puntt L Bal —4 —) : 4 alge ceciee Oe eam mene oe J! Peet . eI es pe oe NTOPIP Co “px aati boy SS) ee ee ee t fal Ad. At 7 a ph sis aAl t+ 4 Airy ere ae be icob = Siesost nn i < : oe danke ‘tb Le tag J Ciniook bind - z we ae a «it do pinh. WN tnt oC )rxaaly citrine to ani sdk cota a/ 2" di lees ao iC ae a LC’ frsnalo no tesenT | f iC fesers(9 AD sramgh ows ¥ eet aay Stara r£SAaobe elt poloeiG = eer aas Bea‘at, J LObixd Pp a 2 Abateg ab’ = 2083 ghtioda sav. Sele ih 9 ol?) dr'n. CAD & “h yas] ini “fry 4 doatien? 5 - cast * EB break ; Data Struct - ta Structures Using ‘C’ (22317) X. _C Program Code Cage 2 3 os % +P stack is << aint? Cf *\ 4 ae . : break ; cases % display () 5 ‘b s jeak 5. git (5° Mile Cchl 2.4) > getchl)s as lemend from XI. Resources required . . Sr. ‘Name of a No. Resource Specification Quantity Remarks Hardware: Computer (i3-i5 preferable), 1 Coinputer RAM minimum 2 GB and ‘System ‘onwards : “Windows 7 or Later As per batch For all 2 | Operating system Version/LINUX version 5.0 size Experiments : or Later Version 5 ba Software Furbo C/C+t Version 3.0, or later , gcc compiler Maharashtra State Board of Technical Education a a HeuVigUoA Data Structures Using ‘C’ (22317) XI. Precautions hack 1. Give proper max-size for sta° «od folders: 2. Programs should be saved in sired XIII. Resources used S. No] Name of Resource T | Computer System with broad specifications 2 | Software ‘Any other resource used XIV. Result (Output of the Program) XVI. Practical Related Questions Note: Below given are few sample questions for reference. Teacher must design more such questions so as to ensure the achievement of identified CO. (Note: Programming exercise use blank pages provided or attach more pages if needed.) 1) Draw stack after POP operation using given below diagram. pop() . ‘Ans: Jrashura State Board of Technical Education . 50 bee =~ 691s) 2) Draw stack after p given stack 'USH operation using given st a PUSHYS) Write a TOP value after PUSH operation, me \ _- PUSHES) - ~ 3) XVII. Exercise (Note: Programming exercise use blank pages provided or attach more pages if needed.) 1) Perform following operation on stack of size 5. _ PUSH(30) PUSH(12) ¢ PUSH(10) -< POPO PUSH(45) POP(70) yeh) Implement a “C” program to stack size-8 for push(10), push(20), pop, push(10), push(20), pop, pop. Pop, push(20)- Perform following operation on s PUSH(100) PUSH(120) : PUSH(50) : POP() POP(, POP(70) ; pop and draw final output. 2 tack of sizé 5. 3 arashtra State Board ‘of Technical Education i es Be “oo Data 8 t tuctures Using *C* (223 17) (Space for answers) rashtra State Board of Technical Education ee Data Structures Using ations on delete oper tan! i . 8: Perform insert * ray Practical No. 8: fecar queue using a0" 22317) ms from two ends on given lisp 1 Practical Significance: P operatio 2 In order to perform INSERT and DE) Pear Queue is collection of, elements that based on First in First out (FIFO) order: ices, front and rear one for Insey, follows.the FIFO order which keep track © and another for Delete.” sciences and basie Relevant Program Outcomes (POS) es mathematics, u. owledge of basic aa roblems. engineering to solve the computer groUP related P! oblensgwledge to solve bros © Discipline knowledge: Apply Information Techno logy - i lems. ; based Information Technology related Pro cet im ¢ Experiments and practice: Plan to perform exper! * Basic knowledge: Apply kn' lems. results to 5 ter group related prov! ; ults to solve the computer SOP A mputer programming / technologies ang * Engincering tools: Apply relevant tools with’an understanding of the limitations. . and written form. 4 ‘© Communication: Communicate effectively in oral Competency and Practical skills . practi he following skills in the student. 1 This practical expects to develop t Develop 'C' programs to solve computer group related problems. 1. Write algorithm and draw flow chart of linear queue for Insert and Delete . operations. 2. Compile/Debug/ save the *C’ program. Relevant Course Outcome(s) : queue using array representation. Iv. «Implement basic operations on stack and Practical Outcome (PrOs) Write *C’ program to perform INSERT and DELETE operations on linear queue Vv. using Array Part-I and II. Vi. Relevant Affective domain related Outcome(s) 1. Follow ethical practices. VII. Minimum Theoretical Background ‘A queue is a linear list of elements in which deletion of an element can take place only at one end called the front and insertion can take place on the other end which is termed as rear. The term front and rear are used frequently while describing queues it 4 linked list. In a queue the first item inserted is the first to be removed (First-In-First 54 Maharashira State Board of Technical Education — _ Data Structures Using ‘C’ (22317) ele ment 7 : Vu. Algoritam Insext 0 yhen- Shep i'- Lf tear = max by wate Puce He a ot Fhen. 4 ; He step2 Bont eet htt set front 2 Thay ae else. set year = year +13 End 14+ . ste ps '- set quer Drea] © nam step4- Exit = polete cin element y ¥hen wvshe queue: steph if dront =o) 1 front 7 Ye4 x a Undeyflow else - Sey dada = guewe Lavon | sat Tron J tronk ay Ix. rowehar Sfp 2 * ~Exit: igueue I's overd lo | | | tz tront = year gueve Fre ar] «nam - End. ) : 36 Maharashtra Siate Board of Technical Education yuctures Using *C° 22317) pt C Program Code yal=ou Feo ye ttendl ; vetu 2 \ yn vals Q int ptak ©). setur (ent eed Void display () ee inti; . for(izo prc syean s itt) E puinat (4 \t 1d, queue OJ) 5 3 | /X1 Resources required >| ‘Name of 7 1| No Resource Specification Quantity Remarks Hardware: Computer (13-15 preferable), 1 Computer RAM minimum 2 GB and = System onwards 7 : : Windows 7 or Later Asperbatch | \-Forall 3 | Operating system | Version/LINUX version 5.0 size Experiments or Later Version ; Turbo C/C+ Version 3.0, or ae | 3 Software later , gcc compiler fckarashira Siate Board of Technical Education 37 Data Structures Usins XII. Precautions 1. Programs should be S# XIII. Resources used 1 ‘Computer System™ with broad specifications 2 Software 3 | Any other resource used ( 1 XIV, Result (Output of the Program) XV. XVI. Practical Related Questions Note: Below given are few sample questions for reference. Teacher must design more such questions $0 as 0 ensure the achievement of identified CO. : (Note: ‘Programming exercise use blank pages provided of attach more pages if needed.) : d rear values of linear queue. p / 1) Write a front an 7 ‘Enqueue Dequeus Ans: 2) Sketch the front and rear in empty queue. o 9 2 8 ws 7 peste eT ea te] ira State Board of Technical Education faharasht 58 | inte(<\n MENU) oe pintt a \. “Unsert); yee ler?’ pE peer n a0, of uplay’ ry v pe atic fey 5. Exir’) in Cn en ten your chosce “4 + Gerey 3 v9: Switch(ch)- f | § - za Cage 1 tnger tl) > breaks Oy Cfront 22-1 TE to ombi) 2 iad nog 4 Ae ae ££ANa) ee esa ise Shal helorlislarlenlonlenl Ll 3) Sketch he fon andy ar in this que, a Ry ue, # ele 4 ke Ans:~ [> Ts] a Technical Education ata Structures Using “C’ (22317) fed or attach more pages if XVI. Exercise” a (Notes Programming exereise use blank pages PF”" Prog : ize 5-with this operation, 1) Implement a C program to Linear a in array: DELETE, INSERT(40), Is 10 with this operations s INSERT@S), INSERT(S5), INSERTO™) array si implement a C program to Linear que! SERT(20), DEL eee} eer Cal), si LETE, INSERTCO)> IN ETE, INSERT(40). 3). Write a ‘c’ program for linear queue using artay a o_o a sn Empty Queue EnQueve an pages for answers) . from given data. (Attach separate Hiaharashira State Board of Technical Education 60 Qy id delete operations on ray Practical No. 9: Perform insert ane tt circular queue using jons from 80 ends OM given ji ‘location i, ercome thi, E operatis en Linear queue deleted item 'y that location, So to 0 In onder to perform INSERT and DELETE based on First in First out (FIFO) order. But in wasted because another data item cannot oc Circular Queue can be the feasible option. basic mathematics, sciences and basig Relevant Program Outcomes (POS) mm ‘ledge of * Basic knowledge: Apply knowledge 0! anal engineering to solve the computer group related Peo en nowledge to solve broad, +. Discipline knowledge: Apply ltennationy ee ~ based Inti Technology related problems. i Sie Test an to perform experiments and practices to use the Jems. results to solve the computer group related prob! ing / tecl * Engineering tools: Apply relevant Computer programming / technologies ang tools with an understanding of the limitations. . CZ Commnication: Communicate effectively in oral and written form. TH. “Competency and Practical skills . . fa This practical expects to develop the following skills in the student. Develop 'C' programs to solve computer group related problems. 1. Write algorithm and draw flow chart of circular queue for Insert and Delete operations. 2. Compile/Debug/ Save the *C’ program. IV. Relevant Course Outcome(s) + Implement basic operations on stack and queue using array representation. V. Practica Outcome (PrOs) * Wfite °C” program to perform INSERT and DELETE operations on circular queue 1g Array Part-I and II. ‘VI. Relevant Affective domain related Outcome(s) . * 1. Follow ethical practices. 2. Follow Safety practices TI. Minimum Theoretical Background Circular queue is a linear data structure. It follows FIFO principle. In circular queue the last node is connected back to the first node to make a circle. Elements are added at the rear end and the elements are deleted at front end of the queue. Any position before front is also after rear. It is also called ‘Ring Buffer’, : washtra State Board of Technical Education VIL. Algorithm [ 2 -) then Step 4 TF tron} <0 and rears mar writer “ove flow’ apse then else if front 2-1 and ¥ a set front =veay =O oo Fhe else if veay 2 max-| and fron Sut rear co Se. set reay = rear +) End of if Step 2 :- set muewe [reav] =v) steps ‘- Exit. eo Haig. ANP or Gand Ty tit Lqmae tipte c arvutor ( pol == phob « Maharashtra State Board of Technical Education 1 Data Structures Usi 2317) VII. Minimum Theoretical Background Fi f collection of nodes in a sequence ists OF * Linked List: Linked List data sous consists of its own data ana the address of ich is divided i .. Each node consists te stacks, queues, aang eee atchata Linked Lists are used to creal q trees, and graphs. Figl. Node xt Node in the li Data holds the data variable while Next holds the address {0 the nie n the list, Head ° Ly] 02 03 Ny Fig 2. Linked List uct Node which acts as the Head(starting of a ‘ns NULL which means list is empty. Basically ly. point to the next Node in the form on singly linked lists are Head is a pointer variable of type str node) to the list. Initially we set 'Head’ Single Linked Lists are uni- irectional as they can onl list but not to the previous. The operations we can pel ertion, deletion and traversal. yee (Attach separate paper if required) 1. Insert a node i, At Beginning of Linked List ii, At the end of Linked List iii, Ata given position in Linked List 2. Delete a node i. At Beginning of Linked List ii, At the end of Linked List iii. At a given position in Linked List 3. Traversing Linked Lis for (temp = shart 9 femme | enall 5 tempstemp —> net. print C78", temp— data), 4, Searching data from Linked List For ( temp =stait temp l= Null; ttmpstemp> } mMa&xb) \f (temp — data = veturn False; Maharashtra State Board of Technical Education Ta = key \ wturin. tue 3 lua step 4 .- start go 2 <= Allocate memory for newnode ahs Using mvoadri't Funes ton 7 ie step 3 —Accip’ dhe data part of ef five node. Assign p> int hal et ee sden—> nett Sheng. . Wewo NG < ; —» head, step 5 Necinode Let ; dak? 95 eee Por QL — Searched “Tinked Uist —— iigteprt 3 o'2 scheadi stall pt yh Bheibbecha ae pointed .p is 2 then Cend the Sea wt Hh uch t. £ other: retain £24 ship Ad JE NeA- OF Linked ar -eu=|' he fates 1 wite sdep.5 meas got orn he pi Diz at Dadite ~step 6 “fate RelBihd pol iil re bad -! a tote eatban tho sbalaQ oY ests) Y Flow Chart (Attach fe paps Separate p; er if required) t Pypgram Code(Attach separate paper if required stop Tnsevting: new node ior» beqining “4 retasst a Node * Ween HR, nea) Aodé), ox new rode Crnode)* malloc Cof node) j neo node —> next = start yt =new node. ee printf Gener elemtnts ni se 3 gr ted isu eu Hey 19% tol iis Avil B Maharashtra State Bo: Data Structures Us 12317) NI. Resources required =H Piste Remarks Se Name of Resource Specification . 73-15 preferable), Da npsne |}-Computer (13-15 pre! ; Hardwvai ne ~ RAM minimum 2 and Ly cy y 3 Computer System |" ~~ onwards ‘As per batch Forall i T Windows 7 or Later size Experiments 2| Operate Systerh | version/LINUX version 5.0 a ay Shard [2 orLater Version jon 3.0 oF 3 Software Turbo C/C++ Version 5-24 at = later NI. Worn , . Be care jc memory allocation. : Be careful while giving input for dynam! Follow pointer’s fundamentals. 1. 2. XIII. Resources used : Name of Resource Specification UGB Turbo C++ | S.No. ‘Computer System 1 EY . with broad specifications 2 Software Any other resource used 3 / result XIV trdor.m...of. A a OYA XVI. Practical Related Questions Note: Below given are few sample questions for referenc e. Te is ae rode ooee an Toate ihe TEhleTEmione Gf idea Tad COMO Choose right option for followin; E 1 Single linked list uses______no. of pointers a. Zero b. one c. Two d. Three Jaharashira State Board of Technical Education 14 Data Structures Using ‘C” (22317) XVII. Exercise 1 Give syntax of creation of a node. 2 Represent Linked List as Stack and Queu®- 3. Give the output Of G void printList) { struct node *ptr= head; printf("\nl "); Jistart from the beginning while(ptr != NULL){ printf("(%d,%6d) ",ptr->key,ptr->data); ptr = ptr->next;} printf(" ]");} (Space for answers) Maharashtra State Board of Technical Education 16 No. 11: Perform operation on cireular singly linked list Practical Significance In some applications Dynamic memory allo if data items are may prone to storage wastage 1 <& deletes can be used in circular manner. It gives the flexibility in Program Outcomes (POS) 1 Practit cation using simple singly Linked Lig deleted. So simple singly Linked List storage management. II. Relevant e: Apply knowledge of basic mathematics, seiences and basic engineering to solve the broad-based ‘Computer engineering problem. ‘Technology knowledge to solve Discipline knowledge: Apply Information cae based Information Technology related problems. Experiments and practice: Plan’to perform experiments, the results to solve Information Technology related problems. _ « Engineering tools: Apply appro! Engineering / Information ypriate Computer En} / Inf Technology related techniques/ tools with an ‘understanding of the limitations, Communication: Communicate effectively in oral and written form. Ii. Competency and Practical skills ; develop the following skills in you a practical is expect to Develop 'C' programs to solve broad-based computer grouP related problems. 1, Write algorithm and draw Flow Chart for inserting and deleting nodes in circular singly linked list. 2, Write C program for inserting and deleting nodes in circular singly linked list. 3. Compile/Debug/ Save C program for inserting and deleting nodes in circular singly linked list. Basic knowledg practices and to use IV. _ Relevant Course Outcome(s) «Implement basic operations on Linked List. Practical Outcome (PrOs) «Write C program to perform the operations (Insert, Delete, Traverse and Search) ae Circular singly linked list. VI. evant Affective domain related Outcome(s) 1. Follow ethical practices. 2. Follow safety practices. B Maharashtra State ‘Board of Technical Education sC (22317) cos usin z Theoretical Minimum eal Background ah Cireular Linked List: Circular Linked List frst clement points fo the last cleme aie poth Sitigly Linked List and Doubt er Arana er atation of Linked list in which the i ad a Ln clement points to the first element. 3 I List ¢: it Ba an be made into a circular linked data next dere oe data nex ‘ Last Element points back to First Fig 1.Circular Linked List + variable of type struct Node which acts as the Head to ‘the list. ‘nected to last node of list. The operations we can perform on d lists are insertion, deletion and traversal. Head is a pointer Initially Head is cor Circular singly linke: vi. Algorithm (Attach separate paper if required) 1. Insert a node iv. At Beginning of Linked List vy. At the end of Linked List vi. Ata given position in Linked List 2. Delete a node iv. At Beginning of Linked List vy. At the end of Linked List vi. Ata given position in Linked List oCgedip TTTAT HOSES neck = clark 5 tone = tmp > nerd prmntt ("7d") gemp > acta); ~grintt (*< 7A", emp —> data); Searching data from Linked List > next cstart 5 temp = foy(dimp = skart 7 deme svemp > nex ke / t \f (temp — data = = key) wekurn due) if (temp = data = = key) vetuin true 5 vetarn Salst Maharashira State Board of Technical Educa! Data Structures Using *C” (22317) Flow Chart (Attach separate paper if required) Neawnode —> nixk = ¢emp— next a nxt = cone niwhode Ix. Stay Yead element 4 ke create newnocle é*glement Display ingey ted’) X. ‘C? Program Code (Attach separate paper if required.) 10 gyam foy inseyd ng elemtnt in before: | *Node # tmp 4 Newnode. : printf C \n enter clement”) 5 scant (**7.d”, element) neo-node =C node #) Mallee (sree of node) 5 temp = Search Chey); hewnode = next = temp-> next s temp —> next> ntw node. ‘4 printt C£8\n Element Inserted ””) 5 : See ‘Maharashtra State Board of Technical Education 80 yo Resources required 2 ae Name of Resource Hardware: a Specification Computer OMmputer (135; Quantit ie =i5 'y | R System minimum Longe, RAM emarks Operating system | Windows 7 olay onwards, ates ater Versi Software |___version 5.0 or Late For all Turbo IC+ Very Experiments | — Version 3, xl. Precautions | 1. Be careful while giving j . input for ome 2. Keep track of ne: ir tT dynami P track of next pointer to observe Circular sn se ration. ar singly linked {i ul. Resources used inked list No] Name of Resource 1 | Computer System poecneana with broad specifications eal Compute y RAL 266 3. | Any other resource used Turbo C4 i XIV. Result (Output of the Program) XV. -Conclusion(s) po XVI. Practical Related Questions / | Note: Below given are few sample questions for reference. Teacher must design | more such questions so as to ensure the ‘achievement of identified CO. Choose the right option from following: 1 Circular Single linked list uses ____- ~~ a. Zero b. one . Two d. Three no: of pointers vashira State Board of Technical Education Data Structures'Using ‘C* (22317) 1 inked list to insert an item in the 2. No. of pointers to be manipulated in a Circular Ti middle__ a, Two b. Three e. One d. Zero 3. Linked lists are not suitable-for data structures 0! problem? a. insertion sort b. Binary search ¢. radi d. polynomial manipulation problem 4. The last node of Circular linked list field(s) having ‘a.data b. pointer . pointer tonext node d. point £ which one of the following jix sort ter to first node XVII. Exercise 1. Give the benefit of Circular Single Linked List. 2. Represent Linked List as Circular Queue. (Space for answers) ‘Maharashtra State Board of Technical Education ita Structures Using *C’ (22317) ary search tree Practical No. 12: Perform traversing on I. Practical Significance hierarchical data a Tree . on’ hieré To perforin operations in some application which WOE O77 represent data in data structure is most known Data structure. Tree 15 UY scray and a linked hierarchical manner. A binary tree can be used 10 represen list. HL. _ Relevant Program Outcomes (POS) ae . ics, sciences and basic *. Basic knowledge: Apply knowledge of basic arate prObIeM. engineering to solve the broad-based ee Oley knowledge to solve broad- © Discipline knowledge: Apply Information based Information Technology related problems. ts, practices and to use the * Experiments and practice: Plan to perform experime™ results to solve Information Technology related problems. ering / Information : © Engineering tools: Apply appropriate Computer Ehgineet ne ins ’ Technology related techniques/ tools with an understanding © Communication: Communicate effectively in oral and written form. TM. Competency and Practical skills oan This practical is expect to develop the following skills in you Ve Develop 'C' programs to solve broad-based computer group related problems. 1. Write algorithm and draw Flow Chart for Traversing Tree. 2. Write a C program for Traversing Tree 3. Compile/Debug/Save the C program. IV. Relevant Course Outcome(s) «Implement program to create and traverse tree to solve problems. V. Practical Outcome Write C program to implement BST(Binary Search Tree) and traverse the tree (inorder, Preorder, Postorder) VI. Relevant Affective domain related Outcome(s) 1. Follow safety measures 2. Follow ethical practices. ate Board of Technical Education Maharashtra St aa para Structures Using °C” (22317) vil. Minimum Theoretical Background Binary Search Tree (BST) : A binary search tree is a tree where each node has a left and right chil it may be missing. A node's left child Traversing : Unlike linear data structures (Array, a Linked List, Queues, Siacks, ete) which have only one logical way to traverse them, trees can be traversed in different ways. Following : are the generally used ways for traversing trees. Tree Traversals: (@) Inorder (b) Preorder (©) Postorder VIM. Algorithm (Attach separate paper if required) 1.” Create Binary Search Treé P . step t~ start Step2 | Root = Null faa GF steps t- Read key value for new Bee yf root 40 Ads"gn yoot =Nnew node goto stepa c- +emp = root: a ; steps, ‘- TH wey < demp adda _ - stepe i- Atmp= temp —» {a3 step t 2 Repeat drom 2 bits value. . - 1 (event, — data < Shey Root —> Left = Nall gqrente > dada = stepq i- stop. Maharashtra State Board of Technical Education 85 2. Traversal i. Inorder ii, Preorder _— iii, Postorder » Inorder. @ start © Trans verse the left subtree De -call Lnorde, @ wstt the yoot. @® Transverse the mght sub Thorder . ve Exit. i % prlordler dryee Ve -cay © start @ vurtsit Ahe root ® Transverse the lett @© Transverse ye v'gh pre . © Exrk. ‘i ‘4 * x, : ' ? pos o1der () start : @® Transverse the left subdree Me, eal) ost; 7 ; ' ; Ve @ Transverse the arght “subliee Ve call post- fend @ Utset dhe took © tog) Cube os gubivee ve call pre y gubdree He. Call “Rfaharashira State Board of Technical Education ” Chart (Attach Flow Separate ete ‘ Paper if required) Aisplay Binary Search Aree crecded - ‘Insest node moist | TE «c? Program Code(Attach separate paper if required) ots insert node (oot ist Co) 5 for (fs li ten; (tt)p ngert node Cyood Vist liq 9 node. a Msere Node Crode* Int data, item) “cursen+) Node) mallsc (she. oF a\ttm, niuw = node da xen new -node’, Data Structures Using *C’ (22317) nk Resources required ‘Quantity Remarks ae Namelof Specification rare 1o. Resource ‘Computer (13-15 preferable) Hardware: 1 Computer RAM minimum 2 GB an : F , System grads, * ‘qs per batch] Foralll Windows 7 or Later size Experiments 2 | Operatifg system | -Version/LINUX version 5.0 or Later Version Turbo C/C++ Version 3.0 oF later,gce compiler ss a ie ~ Sy. XII. Precautions, ag P38 TOS software: 1. Handle dynamic memory allocation carefully. XII. Resources used poteeeess S.No} Name of Resource Specification Computer System y 1 5 with broad specifications | Computey RAM 248 ! 2 Software Turbo -Ct4 3. | Any other resource used ye (Output of the Program) . ; TAIv TS 23 ted Ct rf Maharashtra State Board of Technical Education = Related Questions : Below given are few sample questions for reference. Teacher must de. questions so as 10 ensure the achievement of identified CO. Choose right option from following: 1. Every binary tree with n elements have _(y-no of edges. a)n b)n-1 ¢)n-2 d)nt 2. Define inorder traversal ans: _(__ a)leftrootright —_b) rootleftzright ) leftrightroot _—_d) none 3. Define postorder traversal ans: a) left,root,right b) root,lefiright ©) lefi,right,root d) none 4. Define converse postorder traversal ans:_b _ a) left,root,right b) root,lefiright ©) right,left,root XVII Exercise 1, Create a binary search tree of capital alphabets. 2. Traverse the above Binary search tree recursively in Preorder (Space for Answer)

You might also like