CS2201 Data Structure Tutorial



Comments



Description

SEMESTER II CS2201 DATA STRUCTURES TUTORIAL SHEETDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA Module – I 1. 2. 3. 4. How can you define algorithms? Discuss structure and properties of algorithms. Define and Classify data structures. How does one measure the efficiency of algorithms? Distinguish between best, worst and average case complexities of an algorithm. 5. Define O, Ω and Θ notations of time complexity. 6. 7. 8. Compare and contrast exponential time complexity with polynomial time complexity. How are recursive programs analyzed? Analyze the time complexity of the following program: for send = 1 to n do for receive = 1 to send do for ack = 2 to receive do Message = send – (receive + ack); end end end 9. Solve the recurrence relation: if n > 1 if n = 1 S(n) = 2 • S(n – 1) + b • n, = a, Module – II 10. Distinguish between row major and column major ordering of an array. 11. For an n-dimensional array [1 : u1, 1: u2, … 1 : un] obtain the address of the element A[i1, i2, i3, … in] given β to be the home address. 12. Declare a one, two and a three-dimensional array in a programming language ( C/C++) which has the capability to display the addresses of array elements. Verify the various address calculation formulae for any arbitrary element of these arrays. 13. Open an ordered list L[d1, d2, … dn] where each di is the name of a peripheral device, which is maintained in the alphabetical order. Write a program to For the following logical expression ( a and b and c) or d or e or (not h) (i) Obtain the equivalent postfix expression. Implement PQUE as a two dimensional array ARR_PQUE[1:m. Test your program for the evaluation of the equivalent postfix form of the expression ( . d. Retain only the elements in the odd position of the stack and pop out all even positioned elements. I = 364. Insert a device dk onto the list L. … di-1. In this case the new ordered list should be Lnew = (d1. Write functions to perform PUSH and POP operations. Find the length of L. leaving the stack without its top m – 1 elements. B = 2. Simulate insertions and deletions to the queue and display the content of the queue after every operation. 19. b = false. (ii) Evaluate the postfix expression for a = true. 21. be n elements with priorities pi ( 0 ≤ pi ≤ m – 1). If a stack S[1 : N] were to be implemented with the bottom of the stack at S[N]. Execute insertions and deletions presented in a random sequence. 23. D = 3. FRONT = REAR. F = 220. 1:d] where m is the number of priority values and d is the maximum number of data items with a given priority. 25. Include appropriate input/output statements to track the variables participating in recursion. b. e = true. C = 14. What are demerits of a linear stack? 16. d = true. How are insert operations carried out in a stack? 15. 17. E = 110. d2. Write a program to maintain a list of items as a circular queue which is implemented using an array. c = true. write a procedure to undertake push and pop operations on S.(A*B)/D) ↑ C + E – F * H * I for A = 1. Implement a program to evaluate any given postfix expression. … dn) with (n – 1) elements. 14. 20. Update the device dj to dk and print the new list. Write a recursive program to obtain the nth order Fibonacci sequence number. Retrieve the mth element of the stack S from the top (m < n). 18. Implement a stack S of n elements using arrays. If FRONT and REAR were pointers to the physical front and rear of a linear queue. Implement queries using push and pop functions to a.78. h = false. Let PQUE be a priority queue data structure and .621. c. Delete an existing device di from L. How priority queues are implemented using a single queue? 24. di+1. H = 16. What are the disadvantages of the linear queues? How do circular queues help overcome the disadvantages of linear queues? 22.a. comment on the condition. . b. Implement the lists using singly linked list representations. Let X = (x1. x2. trace its (i) adjacency matrix and (ii) adjacency list representations.26. …yn) be two lists with a sorted sequence of elements. Outline the node structure and a linked queue to represent the polynomial: 17x5 + 18x2 + 9x + 89. Write a program to merge the two lists together as a single list Z with m + n elements. … xn). P2 with the first and the last n nodes of the list P in them. What are traversable queues? 39. 34. 40. 43. Module – III 27. Sketch a multiply linked list representation for the following sparse matrix: -9 0 0 0 0 0 5 7 0 0 0 0 0 0 2 5 33. What are the advantages of circular lists over singly linked lists? 29. y2. What is the need for linked representation of lists? 28. 42. What are the conditions for testing a linked list T is empty. What are the advantages and disadvantages of doubly linked lists over singly linked lists? 30. How are push and pop operations implemented on a linked stack? 38. Demonstrate the application of singly linked lists for the addition of the polynomials P1 and P2 given below: P1: 19x6 + 78x4 + 6x3 – 23x2 – 34 P2: 67x6 + 89x5 – 23x3 – 75x2 – 89x -21 33. Module – IV 41. Write a program which will split a circularly linked list P with n nodes into two circularly linked lists P1. For a graph of your choice. respectively. How is the memory storage pool associated with a linked stack data structure for its operations? 37. What is the use of a head node in a linked list? 31. . if T is a (i) Simple singly linked list (ii) headed singly linked list (iii) Simple circularly linked list and (iv) headed circularly linked list? 32. Write a program to evaluate a postfix expression using a linked stack implementation. Y = (y1. Draw graphs that contain (i) an Eulerian walk and (ii) a Hamiltonian circuit. Implement a deque DQUE in a one dimensional array. What are the merits of linked stacks and queues over their sequential counterparts? 36. Distinguish between digraphs and undirected graphs. 35. How is the rotation free deletion of a node having both the subtrees. Write a recursive function to count the number of nodes in a binary tree. undertaken in a binary search tree? 57. preorder and post order. done in an AVL search tree? . trace the binary tree. How can graph traversal procedures help in detecting graph connectivity? 45. Sketch a linked representation for a threaded binary tree equivalent of the binary tree shown in fig. Write a program to implement a binary tree using linked representation. Given the following inorder and preorder traversals. Write non-recursive functions to perform inorder. 1 48. How is binary search tree representation of lists advantageous over their sequential list representations? 56. Use functions to traverse it in inorder. 8 4 9 1 5 7 Fig. What is the need for an AVL Tree? 58. Draw an expression tree for the following logical expression: p and (q or not k) and (s or b or h) 51. 52. Module . Implement Dijkstra’s algorithm to obtain shortest path from a given source vertex (of your choice) to every other vertex of a graph of your choice which must at least 10 nodes with 5 cycles. Inorder traversal: B F G H P R S T W Y Z Preorder traversal: P F B H G S R Y T W Z.44. 54.V 47. 46. Sketch (i) an array representation and (ii) a linked representation for the binary tree shown in figure 1. 53. 49. How is the deletion of a node that has both left and right subtrees. 1. preorder and post order traversals of a binary tree. Obtain inorder and post order traversals for the binary tree shown in fig. 1. 55. Discuss an algorithm for finding minimum cost spanning tree. 50. THEN. What are the merits of m-way search trees over AVL search trees? 61. LET. calculator} . 655. IF. XOR} a. ribbon. 345. 344. Insert the following elements in the order given into an empty B tree of order (i) 3 (ii) 4 and (iii) 7: Z R T A D F H Q W C V B S E O P L J K M N U T X. 122. Undertake the following operations on the B trees: (i) delete Q (ii) delete A (iii) delete M 65.59. list a case. pot. paper. 009. 67. Construct a binary search tree. 233. DO . 111. Distinguish between internal sorting and external sorting. pencil. QUIT. NOT. 566} 76. FOR. pen. What is the height of a B tree of order m? 64. For the following search list undertake (i) linear ordered search (ii) binary search in the data list given. GOTO. What are your observations? Construct an AVL search tree. READ. 71. BEGIN. Module – VI 66. Tabulate the number of comparisons made for each key in the search list. 876. When is a sorting process said to be stable? Why is bubble sort stable? 68. 453. Module – VII 72. What is the need for B trees? 63. 345. What is the principle behind Shell sort? 69. What are the advantages of binary search over sequential search? 73. Trace Quick sort on the following list L = { 123. 877. 231. Give an example. 238} Data list: {111. Data list: {pin. construct a 3-way search tree. 654. 678. 112. RESET. IN. 890. For the data list given in Question 63. eraser. REPEAT. CASE. 225. 60. UNTIL. Distinguish between a heap and a binary search tree. clip. stapler. OR. For the given data list and search list. b. 679. For the data list { AND. When is a transpose sequential search said to be most successful? 74. What are the demerits of m-way search trees? 62. 009. duster. tabulate the number of comparisons made when (i) a transpose sequential search and (ii) interpolation search is undertaken on the keys belonging to the search list. WHILE. Search list: {766. chalk. 324. Insert G and delete J K and Z from the search tree. scale. 999. Can bubble sort ever perform better than quick sort? If so. 988. 238. ink. 209}. 144. END . 70. 789. What is the principle behind interpolation search? 75. 766. calculator} ------ . clip. paper. pin.Search list: {pen. Documents Similar To CS2201 Data Structure TutorialSkip carouselcarousel previouscarousel next8051Keyboard Interfacing12. HashingLNm78051Data Structures and Algorithms04.EfficiencyofAlgorithmsEMBEDED SYSTEMS AND REALTIME SYSTEMSSortschandu tagcoludOperating SystemsMANCHI MAATALUMatlab Plot TutorialData Structuresppt tutorialDS SortingSniffles the Crocodile, Punch the Butterfly - Teluguppt36853207 C Programming PptData Structure & Files (SEM - III) CMPN VidyalankarUGC-NET JUNE-2012 COMPUTER SCIENCE PAPERRadix SortOpencv2.3_CheatSheetca tp - CopySubject Allotment @ 04-06-2012Career ChartComputer Organization- Address modeskeyboardcomputer organizationSubjects Allotment 2011-12More From Yogesh YadavSkip carouselcarousel previouscarousel nextTesting Swenga2p Creates a Perl Script From an Awk ScriptNavathe SQL9. Binary Trees and Binary Search TreesFooter MenuBack To TopAboutAbout ScribdPressOur blogJoin our team!Contact UsJoin todayInvite FriendsGiftsLegalTermsPrivacyCopyrightSupportHelp / FAQAccessibilityPurchase helpAdChoicesPublishersSocial MediaCopyright © 2018 Scribd Inc. .Browse Books.Site Directory.Site Language: English中文EspañolالعربيةPortuguês日本語DeutschFrançaisTurkceРусский языкTiếng việtJęzyk polskiBahasa indonesiaSign up to vote on this titleUsefulNot usefulMaster Your Semester with Scribd & The New York TimesSpecial offer for students: Only $4.99/month.Master Your Semester with a Special Offer from Scribd & The New York TimesRead Free for 30 DaysCancel anytime.Read Free for 30 DaysYou're Reading a Free PreviewDownloadClose DialogAre you sure?This action might not be possible to undo. Are you sure you want to continue?CANCELOK
Copyright © 2024 DOKUMEN.SITE Inc.