DocScanner Oct 5, 2023 4-14 PM
DocScanner Oct 5, 2023 4-14 PM
Haig. ANP or Gand Ty tit Lqmae tipte c arvutor ( pol == phob « Maharashtra State Board of Technical Education 1Data 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 3lua 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 eeePor 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 sbalaQoY 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 14Data 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 16No. 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 EducationsC (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 80yo 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 EducationData 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 Educationita 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 aapara 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 852. 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)