0% found this document useful (0 votes)
45 views12 pages

( - Previous - Questons) (Midterm) CSE-134 Data Structure

(_previous_questons)(Midterm) CSE-134 Data Structure

Uploaded by

pritomsaha208
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)
45 views12 pages

( - Previous - Questons) (Midterm) CSE-134 Data Structure

(_previous_questons)(Midterm) CSE-134 Data Structure

Uploaded by

pritomsaha208
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/ 12
Daffodil International University | Department of Computer Science and Engineering Faculty of Science & Information Technology Midterm Examination, Fall 2022 Course Code: CSE134, Course Title: Data Structures . Levi Term:1 Batch: 60 Time: 01:30 Hrs Marks: 25 ‘Answer ALL Questions 1. a) Whatis the time complexity of the following code segment? 2 int main() cot printf(*DIU CSE"); 1 ) fork = 1;k / 02 polos | > x pt x pt ox opt @- Write code to implement the above and assign the data shown. Ao. Create another 4" node at the end and assign with 05 for “x”. Connect the “pt” member to the first node. N.B. declare the node and write only required code but not the whole program Part C: Queue, Stack and Applications 34342 L ‘onsider a Stack using link list is created with the following operations: ‘pyshtl |); pysht7); pusb(S), popd): ppsh(12); pusht9); pape ppx); pow) oe the state of the a during each operation and the final content of the stack. i tion stack in the real life 2*3 into postfix using Sack, eer onvent tie infix expression 8-3*2- += Good Luck _ §& Daffodil International University Department of Computer Science and Engineering, Faculty of Scieace and Information Technology Midterm Examination Semester: Fall 2017 Course Code: CSE134_ Course Title: Data Structures Section: ALL ‘Course Teacher: ALL br 30 minutes Full Marks: 25 Pafé A: Analytical (write the answer with reason in the answer booklet) 3X2=6 Linked list data structure offers considerable saving in @) Computational Time ppSpace Utilization c) Space Urilzation and Computational Time ‘None of the mentioned 4 assuming int is of Abytes, what is the size of int arr{15]; ? 5 B19 ay60 ‘What kind of linked list is best to answer question li a) Singly linked list b) Doubly linked list ¢) Circular linked list 9 Arr. ike “What is the item at position n?” say implementation of linked list Part B: Link List 4434143 1. Consider the following Vink list: i _ Lit | 1 Anger the following questions: a A lt tai Feiss setae ee a cennes at wil be time complex} if you function "count which will eum number of items inthe Fist. , Stack and Applications DDAD+2 Part 2 gree ' Stack using link lst is created with the following operations: ‘push(5); push(3); papO; Push(7); push(11); PopOs PopOs final content of the stack. tray the state of the stack during each operation and the J. the linked list implementation ofthe stack, where does the push member function place the ew entry om the linked list and why? mivert the infix expression 5+3*2-8/4+6-42 into postfix using stack. Lifes ‘25 element stack S (from top to bottom: 2, 4,6, 8, 10), and an enspty queue Q, remove Joe ements oae-by-one from S and insert them into Q, then remove them one-by-one rom and re-insert them into S. Draw the final stack S. —---—- Good Luck — be4/- 64404 — S37 Daffodil International University Department of Computer Science and Engineering Faculty of Science and Information Technology Midterm Examination. Semester: SPRING 2017 Course Code: CSE134 Course “Fitle; Data Struetuces Section: ALL Course Teacher: ALL wigs 1 bi 30 wanutes Part A: Visualization of eode 42 Consider the following code and draw the representation from the code: struet Node{ ints 9; oat 2; struct Node tp struct Nede } typedef struct Node node; node *head; head = (node *) malloe(sizeof node): head —>2-2.2; head->x= head>y~5:head-> NULL; hread>g ~ (node) malloc(sizeofinode); hhead->4-x~head->9->y= head->g->t =0; head->q->p=NULL;head->4->9=NUL! 1. Draw the picture representation ofthe above code, 2 Why the above structare is ealed selfreferential structure. Part B: Working with Link List 643°3 (@) Consider you have to create a Node which edntains an integer and a float data member and a pointer member of its same type. Using this viade you need to create a link list of three nodes ‘connected to each other. The data you need to store are: (3, 2.7} {5, 3.7} {7,2.9}. Write code using C language to create the node and assizn the data along with the link. (b) Consider the following link list: “AG 2 et -bea. The “Node” contains an integer data member “data and a pointer member “next”. Write code for the following operat (1) A function to insertanode|_ |" a: the end of the list. (2) A funetica to delete the node{ 2 |-—}-»'The function receive the data to b: deleted as the paramete= when called. (3) A funeticn to count number of data in the list, The function returns the number of ii N.B. declare nods and write the required code only Part B: Stack and Applications 4 (@) Convert the following expressions: 2284 (1) /+-" 6282/63 to Infix and then convert it into postfix using Stack. (2) 5-8/44245+7-3"2 to Prefix and Postfix Good Luck Daffodil International University Department of Computer Science and Engineering Faculty of Science and Information Technology Midterm Examination, Semester: FALL 2016 Course Code: CSE134 Course Title: Data Structures Section: ALL — Course Teacher: ALL Time: 1 hr 30 minutes Full Marks: 25 Part A: Visualize Link Node 5 ‘Consider the following code and draw the representation from th struct Nodef float a int b: struct Node *next; struct Node *prev; y ‘ppedef struct Node node; node *head; head = (nade *) malloe(sizeoff node); head >a=3.2; head->b=7,head-> prev=NULL: head->next = (node*) malloe(sizeofinode)): head->next->a=head->next-> ye code: b=0; head->next->next= NULL head->prev-> prev=NULL, Part B: Working with Link List 74343 (a) Write code for the following: (write code to create the nodes and assign as per the following diagrem; the node variable name is “head”) Piet} oe a | 32 | —F 2 (b) Consider the following link list: “GPhELBELEE LHe ‘The “Node” contains an integer data member “data” and a pointer member “next”. Write code for the following operations. (1) A function to inserta node| Ut |} [> at the end of the list. (2) A function to delete the node| 5 |-—7-®The function receive the data to be deleted as the parameter when called (3) A function to count number of data in the list. The function returns the number of items, N.B. declare node and write the required code only without main and includes Part B: Stack and Applications 4 (a) Convert the following expressions: 22-4 (1) *+-*8293/42 to Infix and then convert it into postfix using Stack. (2) 9-3°246/3+8-42 to Prefix and Postfix —-- Good Luck ~ | | a A function to nsert » node athe end of [Bor tincsion 6 delete anode, The futon reve the data 0 be deleted as she parameter when inion 0. ste parameter when = | ¥@¥a function to count numberof data inthe list. The funetionretums the number of i 2B, declare node and vsti the required code but not the whole programm oe ional University Science and Engin‘ Daffodil Interna Department of Computer s Faculty of Science and Information Technology Midterm Examination, Semester: SUMMER 2016 ‘Course Title: Data Structures Course Teacher: ALL F part A: Visualize Consider te fellowing code ant draw the repress = A. fetal nrvct Node node ride “head, i fad = (nore *) malioc(sizeoft nd paid 01-5, he id >next = (no I ed rrmhuad-> 50: he Part Be Working with Link List Arie code forte d>next=NULL (write code to create ad SGT HEL ‘The “Nowe” coniains an integer data n foslowing operations. Write tack and Applications ¢ following expressicns' fa Convert th 2-101 ring Sta GF 932469+8-42 to Prefix and rustix = God Lick -

You might also like