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

Data Structures

first chapter of data structures btech 2nd year

Uploaded by

Sam Amulya
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
14 views

Data Structures

first chapter of data structures btech 2nd year

Uploaded by

Sam Amulya
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 66
(Common to CSE, IT, CE(SE), CSE(CS), CSE(DS), CSE(AI&ML), CSE(IOT), CSE(N), AI&ML, Al&DS, CSD,-CSBS and CSIT) B.Tech Il-Year I-Sem (JNTU-Hyderabad) CGonrTrents Introduction to the Subject Syllabus as per R22 Curriculum List of Programs La -ua MID - 1 & Il (Objective Type & Essay Questions with Key) Ma - M13 University Exams Question Papers with Solutions (Latest to Previous) QP. - Ops Model Question Papers with Solutions (As per the New External Exam Pattern) MPA - MP2 UNIT-WISE QUESTIONS WITH SOLUTIONS Unit'Name “ Topic Name- Topic No. Question Nos. Page Nos. UNIT - 1 Introduction to Data Structures = 1-40 41 Introduction to Data Structures, Abstract Data Types Qi - Q3 2 1.2 Linear List - Singly Linked List Implementation, Insertion, Deletion and Searching Operations on Linear List * a4 - Q10 3 13 Stacks — Operatians, Array and Linked Representations of Stacks an - ara 15 1.4 ‘Stack Applications » Q15 - Q22 21 1.5 Queues - Operations, Array and Linked Representations Q23. ~~ ‘Qa2 28 Very Short Questions with Solutions (VSQS) Qi - Qo 38 Frequently Asked Questions and Important Questions 39-40 UNIT - Dictionaries and Hash Table Representation 4 44-64 24 Dictionaries a a= a3 ae 2.1.1 Linear List Representation Q4 42 2.1.2 Skip List Representation Qs , 7 08 43 2.1.3. Skip List Operations — Insertion, Deletion and : Searching ag - ai2 45 4 Mash lable Kepresemeauur 2.2.1 Hash Functions, Collision Resolution — Separate ‘ ~ Linear Probing, : Cr. oe out Haehln. Rehashing —-«Q17_—--_- 22 50 2.2.2 Extendible Hashing S 60 ai - a8 683 Very Short Questions with Solutions (VSQS) Frequently Asked Questions and Important Questions - 84 UNIT-IIl Search Trees $5 - 108 3.1 Binary Search Trees 6 3.1.1 Definition, Implementation 1, -, 66 3.1.2. Operations — Searching, Insertion and Deletion a4- a8 68 3.2 B-trees, B-trees 08 ach PIB ia 3.3 AVL Trees . 82 3.3.1. Definition, Height of an AVL Tree Q16 - Q18 82 3.3.2. Operations — Insertion, Deletion and Searching aig - Q24 a7 3.4 Red-Black, Splay Trees Q25 - Q38 95 Very Short Questions with Solutions (VSQS) Qi-- Q8 107 Frequently Asked Questions and Important Questions 108 UNIT - IV Graphs and Sorting 109 - 150° 44° Graphs 110 4.1.1 Graph Implementation Methods Q1--. a7 140 4.1.2 Graph Traversal Methods Qs - Qi 115 42 Sorting 122 » 4.2.1 Quick Sort Qi2 - Q13 122 4.2.2 Heap Sort Qi4 - aig 126 4.2.3 External Sorting —- Model for External Sorting Q20 - Q21 141 4.24 Merge Sort - Q22 - Q25 143 Very Short Questions with Solutions (VSQS) Qi - Qs 149 + Frequently Asked Questions and Important Questions 150 UNIT -V_Pattern Matching and Tries 451-178 5.1. Pattern Matching Algorithms Qi 152 5.1.1 Brute Force 3 a2 452 5.1.2 The Boyer-Moore Algorithm Q3 - as 453° 5.1.3 The Knuth-Morris-Pratt. Algorithm ae - as 156 5.2 Standard Tries, Compressed Tries, Suffix Tries a9 - aiz 163 Very Short Questions with Solutions (VSQS) at - as 477 Frequently Asked Questions and Important Questions 478 Mtallows a programmer hips. Some of the data . The purpose of data structures is to ‘memory and secondary memory. Data structures like stacks, queues and hash tables are used for evaluating expression, : (ike printer, disk, CPU) and database ‘ 5 Conceptually manageable relations! structures inclide arrays, stack, ‘Meues, trees and linked fi Store and retrieve data to and from main serving requests of single shared resources indexing. Data struct Si ‘ures are emphasized by most Of the assembly language and low-level Programming Tanguages. One such language is “c* language. It was developed in 1972 by Dennis M.Ritchie at Bell Laboratories (AT and T Bell Labs), The «c* language is d larity of the *C’ language is due to its many characteristics like generality, efficiency and speed, porta ‘igned on BCPL (Basic Combined Programming Language). The popu lity. Ibis a structured programming language that provides Several facilities in order to group data in data structure. The table below gives complete idea about the number ‘f questions that can be asked from each unit in their examination along with their: ‘weightage. This will be hel pf for the students to plan and score ‘200d marks in their exams, SS unt Number of | __ ini i Weightage Unit Qiiestions ightag No. att Name. of Marks Short | Essay ‘This unit includes topics like Introduction to Data Structures, Abstract Data Types, Linear List — Singly Linked-List Implementation, 7 ele ig Insertion, Deletion and Searching Operations on Linear List, Stacks — Operations, Array and Linked Representations of Stacks, Stack . “| Applications, Queues — Operations, Array and Linked Representations, ‘ This uni 1, °| Introduction to Data * | Structures icludes topics like Dictionaries: Linear List Representation, Skip List Representation, Operations — Insertion, Deletion and Searching. Hash Table 2,. | Dictionaries and Hash | Vi 12. Representation: Hash Functions, Col Table Representation ion Resolution — Separate Chaining, Open Addressing Linear Probing, Quadratic Probing, Double Hashing, Rehashing, Extendible Hashing. Search Trees 12 This unit includes topics like Binary Search Trees, Definition, Implementation, Operations ~ Searching, Insertion ang Deletion, B-Trees, BTrees, AVL Tyee, Definition, Height ofan AVL Tree, Operiton, = Insertion, Deletion and Searching, Reg, Black, Splay Trees. 4 Graphs and Sorting v 12 This unit includes topics like Graphs: Graph Implementation Methods. Graph Traversa Methods. Sorting: Quick Sort, Heap Sort, External Sorting, Model for External Sorting, Merge Sort. Patter Matching and Tries 12 ‘This unit includes topics like Pattern Matching Algorithms — Brute Force, The Boyer. | Moore Algorithm, The Knuth-Morris-Pratt Algorithm, Standard ‘Tries, Compressed “Tries, Suffix Tries. SYLLABUS a UNIT-I Introduction o Data Structures, Abstiact Data Types, Linoar st Singly Linked List Implementation, Insertion, Deletion and Searching Operations on Linear List. Stacks - Operations, Array and LUnked Representations of Stacks. Stack Applications, Queues — Operations, Array and Linked UNIT-II Dictionaries: Linear List Representation, Skip List Representation, Operations — Insertion, Deletion and Searching Hash Table Representation: Hash Functions, Collision Resolution - Separate Chaining, Open Adcressing — Linear Probing, Quadratic Probing, Double Hashing, Rehashing, Extendible Hashing. UNIT-III Search Trees: Binary Search Trees, Definition, Implementation, Operations ~ Searching, Insertion 2nd Deletion, B-Trees, B'-Trees, AVL Trees, Definition, Height of an AVL Tree, Operations — Insertion, Deletion and Searching, Red-Black, Splay Trees, UNIT-IV Graphs: Graph Implementation Methods, Graph Traversal Methods, Sorting: Quick Sort, Heap Sort, External Sorting ~ Model for External Sorting, Merge Sort. UNIT-V Patter Matching and Tries: Pattern Matching Algorithms ~ Brute Force, The Boyer-Moore Algorithm, ‘The Knuth-Morris-Pratt Aigorithm, Standard Tries, Compressed Tries, Suffix Tries. ey 7 Program Name Page No, 1. | C program to implement singly linked list with basic operations 13 2. | C program to implement stack operations 7 ~ | C program to implement stack using linked list 19 4. _| C program to convert infix to postfix expression | 24 5. | C program to evaluate the postfix expression 26 6. | C program to implement the queue using an array 29 7.__[C program to implement the queue using linked list | 2 [ SNo. ProgramName | 1. | C programs to implement different methods of hash funetions 52 |_2. | Cprograms to implement different collision resolution techniques 57-60 | | S.No. Program Name Page No. |_1._ | C program to implement various operations of binary search tree 72 2._| Cprogram to implement various operations of AVL tree 93 | S.No. Program Name "| Page No. 1._| C program to implement BFS and DFS traversals of a graph using adjacency list 118 2,_| C program to implement BF§ and DFS traversals of a graph using adjacency matrix} 120 3._| C:program to implement heap sort 129 4. _| Cprogram to implement merge sort 145 | S.No. Program Name Page No. 1. | C program to implement Brute Force pattem matching 153 2.__| C program to implement Boyer-Moore pattern matching 155 3__|C program to implement the Knuth-Morris-Pratt pattern matching 157 I. _ Fill in the Blanks c js a collective name given to a group of elements. A inked list isa list in which each node is linked with other node. Stack structure operates in the fashion 4. The queue insert operation is known as Basic structures used to implement ADT are 6 represents only the definition ofa particular data type and hide: 7. Graphisa * data structure. and .s the implementation, & The set of pointers stored in an array is called . 9. refers to an element in a linked list. 10. The implementation of linear lists can be done by using ___ and Il. Multiple Choice . { 1. Amay is also used to represent . , C) j (2) Graphs (b) Trees (©) Strings (@) Both (a) and (b) ____data structure is one of the classification of data structure. to (2) Linear . (b) Parallel (©) Sequential (@) None of the above j 3. A data structure in which all the data elements are stored in sequential manner is called _data r structure. , is [1 (a) (b) Non-linear g (6) Sequential (d)_ None of the above are used in conversion of expression from infix notation to postfix and prefix notation. » C1 (@) Stacks (b) Queues (c) Linked list . (d) Hashing methods 5. is a data structure similar to stacks and queues. ~ E ] (a) Graph : (b) Tree (c) Priority queue (@) None of the above 6. A____ isan extension of queue data structure, (i () Dequene . (>) Enqueue (©) Circular queue : (@) Priority queue An application of stack is (a) Traffic controlling . (b) Collision resolution _ © Recursion (@) "Open hashing : ixIPhotocopying of this book is MID -1& It M. 8. Which among the following propertics docs not hold good ina Stack? (a) Astack supports the principle of last in first out (b)Allinear stack has limited capacity (©) A-push operation decrements the top pointer (2) Apop operation deletes an item from the stack 9. The number of stacks required to implement queue operations is (4 2 3 w 4 10. A situation when a linked fist START © NULL is (8) Underftow (b) + Overfiow (©) Housefil (a) Saturated Match the Following 1, Staek deletion L1G) Stack 2 uo [1 @) Ate 3. LIPO : C1 © Queve 4. Inft\ expression to. @ +aB S. Prefix expression [1 © Por KEY Fill in the Blanks Amy 2. Singly 7 3. Lastin-First-Out 4. Engueue 5. Array, Linked list 6 ADT 7... Non-linear : 8. Pointer array 9. Node 10. Arrays, Linked lists. Multiple Choice @ @ 23@ £@ 5 © 6 (@ z © & © % & 10 @ Match the Following ? Tan) 2 © 2 @ 46 5 @ 4. In . DATA STRUCTURES [JNTU. HYDERABAD) ‘ » UNIT -II : Fill in the Blanks 1. A___ is aprobabilistic data structure for storing an ordered list of items. is a data structure that is used to store the dictionary pairs. we 3. 0A is a situation that occurs when two different keys want to occupy the same home bucket, 4. refers to the ratio of the total number of hash table elements to the table size. iS! ‘overcomes the clustering problem of linear probing. 6. consists of a group of keys and associated values. 7. Insertion operation of a skip list is an extension to its, operation. operation, . 8. Deletion operation of a skip list is the reverse of | iionary can even be represented by using a method called _ onary pairs to the corresponding entries in a hash table. 10, function is used to map the Multiple Choice ‘The number of comparisons can be decreased to for an n-pair dictionary. tl oe ( ot 1) (a) log(n+1) © (uz) @ (rege) 2. The position of a hash table is determined by _. (a) Hash function (b) Hash key (©), Bucket @ List is a hashing function which is useful in converting multi-word keys into a single word key. CJ (a) Folding (b) Midsquare (©) Division (@) Digit analysis , the collision function is quadratic. [1 (b) Open addressing (a) Linear probing (@) Separate chaining (©) Quadratic probing 5, The value of load factor for open addressing hashing method is less than__"_. ti (a) 04 , (b) 05 © 06 : : (@ 07 6. H(t)=(X mod m) + 1 is.a function for_ method. ft 1 (a) Division (b) Midsquare (©) Digit analysis (@) Algebraic 7 In______ method, the key is multiplied by itself and address is obtained by solving the middle digits tJ from the number, (@) “Midsquare () Digital analysis @)_ Division method (©) Folding method ail M.S Which of the following are the types of open hashing scheme? Cel (@) Linear probing 8 (©) Quadratic probing (© Random probing , (@) Allthe above 9. In___type of hashing, the hash table stores a sct of pointers rather than data elements. [J] , (2) Closed hashing (b) Open hashing (©) Both (a) and (by (@ None of the above 10. Hashing with linear open addressing is commonly known as___ cl * @_ Random probing (b) - Linear probing . © Quadratic probing (@ Allthe above Match the Following . 1. Hashtable {1 (@) Cluster-separating hashing function 2. Hash funetion [1 @) H@=(K mod im) +1 3. Bucket {1° © Mapping dictionary pairs with respective entries : 4, Division method (1 @ Dictionary pairs 5. Algebraic Coding {1 . © Position of the hash table 6 KEY Fill in the Blanks Skip list 2. Hash table 3. Collision 4, Load factor 5. Quadratic probing i 6. Dictionary 7. Search i Insertion 9. Hashing “10, Hash function Multiple Choice Lb) 2 © 3 @) 4 © 5. () ; 6 (a) 1 @ 8 ) 10. (b) Match the Following L @ 2 © 20 40 5 @ ES [JNTU: HYDERABAD) DATA STRUCTUR M. : 3 UNI =—_ I Fill in the Blanks . : 2 3. 4 5. 6... RR rotation is'performed in _— 7. 8 9. binary tree. node is colored in color. of binary tree. Search trees are used to reduce _ ai « search operation in both method 1, AVLtreeisa In red black tree, the root method, Binary search tree perform: - res ‘The difference between the heights of left subtree and right subtree is calle’ direction. play trees are invented by’ Batre of onder m is said to be search tree. “The space complexity for searching a node in red black tree is 10. An AVLitree is balanced by using rotations. Multiple Choice 1.) An AVLtree cannot have this sas a balance factor of any node @ +3 ® + o# @ 0 . 2 Which of the following is not a balanced binary tree? C1 (@ AVLtee < @) Batee (©) Red-black tee . @. None of the above 3. Which one of the following is not a property of binary search tree? ' 6 CJ (2) Allkeys in the tree need not be distinct () All keys in the left subtree are less than the root (c) All keys in the right subtree are greater than the root (4) The left and right subtrees are also binary search trees 4 ae is defined as the difference between the heights of nodes left and right subtess. [_] (@ AVL tree (b) Balance factor (©) Binary search tree (@)_ Non-AVL tree ‘The height of an empty tree is defined as : “yustite py Ont &) 0 ot @. -2 2 6 Atree having optimum cost is known as, on (a) AVLitree (©) Red-black tree es mils 7. An is a tree in which the height of the left 2 Seen en ee oon ie left and right subtrees of every node differ by atmost to7 (@) Optimal binary search tree © AVLtee (b) Red-black tree : (A) Non-AVL tree rax/Photocopying of this book is a CRIMINAI \nyone found guilty is LIABLE to fs LEGAL proceedings. ati I. Ml. (a) AVL tree (©) Optimal binary search tree (a) Om (©) O(log n) 10. Deletion of a record from B*. (a) Leaf (©) Both (a) and (by Match the Following 1, Height of binary search trees, 2. AVL trees 3. BYtress 4. Red-black trees 5. Splay trees Fill in the Blanks 1. Height balanced 2... Black 3. Searching time 4. Iterative, recursive 5: Balance factor 6. Anti-clockwise 7. Sleator and Tarjan 8. m-way 9. O(n) 10. LL, RR,LR, RL Multiple Choice 1 (a) 2 @ 3. (a) 6 @ © 8 (b) Match the Following 1. @d) 2 © 3. (b) (b) Red-black tree (d)_Non-AVL tree ‘The space complexity for searching a node i red black tree is (b) O(n’) . O(n togny ree always starts at the (b) (d) {1 @ Cook oo C1 © tl @ C1 © C0) KEY (b) oa) 4 ©). level. Root None of the above Linear Multilevel index Ottogn) n 2ulog(N + 1) Child node of red-black tree 3. @ 10. (a) 5 @) aayar PS OF SelFbalancing binary search Wee, typically used to implement aasoviative RUCTURES [INTU-HYDERAB Any DATA ST! Fill in the Blanks LA isa graph that contain edges both directly and indirectly. ed representation. js used to store graphs in method checks whether the graph jis empty or not. method; traversal is started from a given vertex V in the graph. 5. are the lists in which nodes may be shared among multiple lists. 6. ‘method is used to create an empty graph. 7. Heap'can be classified as, - 8, The time required for constructing the heap is. of secondary storage. 9. * is an external sorting algorithm which makes us 10. The best case time complexity of merge sort algorithm is I. Multiple Choice 1. Apair of nodes connected by a line segment is called (b) Edge | (a). Vertices | z (c) Graph . (d) Digraph 2° |The minimum number of vertices that a cyclic graph posses is__. CJ (@) One c (6) Two (©) Three (Four 3. Which one of the following is not a graph operation? tJ (@) Addavertex : (b) Find a vertex (©) Delete a vertex (@) Search an edge ‘The standard graph traversals are. (a) Breadth-first traversal (b)Depth-first traversal - i Both (a) and (b) . (d) All the above 5. ‘A graph in which every edge is directed is known as 5 (@) Undirected - (©) Mixed graph ff (©) Adjacency i 6. In an undirected graph, the sum of degrees of alle dome a nodes must be, tl I : (©), Twice the number of edges i oi (a) and . a ‘matrix, an edge between two vertices is represented ine tl . @) 0 @ 2 ce LEGAL proceedings. MID-1& Il ‘ M9 Mm. 1 %__Anenample of a directed graph ie cod @ O—® ) © © Q@ (©) Both (a) and (b) (@)_ None of the above 9, Heap sort belongs tothe family of sorting by ty (@)_ Selection (b) Insertion (©) Exchange (Distribution 10. A__can be used for multi-way merge. f (a) Priority Queue (b) Queue (©) Stack (@) Sorting Match the Following 1. Weighted Graph [1 @)_ External sorting algorithm 2. Complete Graph : {1 @®) Agraph with all directed edges 3. Connected Graph {1 ©) Vertex contains edges to all the vertices from it 4. Directed Graph ; [, 1, @__ Edges labeled with weights Merge sort { 1. © _ Exists a path between any two vertices: KEY Fill in the Blanks 1. Mixed graph Adjacency list Boolean IsEmpty(.) Depth First Traversal Adjacency Multi lists” create( ) min heap, max heap 2 O(n) yen ah ae D Merge sort 10. O(n logn) Multiple Choice LO 2oO.3@ 40 5&5 @ 6 @ 7 @ 8 @ -% @ 10. (a) Match the Following @. 20© 3 © 40 5 @ SPECTROM ALL-IN-ONE JOURNAL FOR ENGINEERING STUDENTS. M.10 DATA STRUCTURES [JNTU-HYDERABAp, UNIT -V 1, Fill in the Blanks shod that identifies the occurrence of pattern in a text from a given pattern. 1 2 isame 3, ‘The time complexity of searching phase in Brute-Force pattern matching algorithm is 3, ‘The time complexity of searching phase in the Boyer-Moore algorithm is . 4 function is used to prevent backtracking on a string. 7 8 algorithm is used when the given pattern consists of redundant characters. 6. The term trie is derived from the word 7 7, The height of a standard trie is the longest path from to 8. Astandard tric has a binary structure when the alphabet has only characters. % is an ordered tree data structure that stores an associative array. 10.” The worst case running time of Boyer-Moore algorithm is Il, Multiple Choice 1 algorithm acts as a word processor that searches a word present in text document. [_ ] (a) Boyer-Moore (b) Knuth-Morris (©) Brute Force Pattern (@® KMP 2. The complexity of searching phase of Knuth-MorrisPratt algorithm is _- [1 (a) O(m) (6) O(n) © Om) * (OW) 3. help with longest prefix matching. [J @) Tre (6) Graph (©) Node @_ None of the above 4A trie structure is useful when the size of key values vary. tJ (a) Compressed tries (b) Multiway tries (© Patricia @ Binary Tries 5. ‘support search, insert and delete operations in O(d-m) time. [1 (@) Standard tries (©) Suffix tries (©) Binary tries (@) Compressed tries 6. Which of the following is used in a comy ie wit pressed trie with labeled searches before reaching an element node or fill ofthe wie? Ser mints | a) Skip field , (a) Skip fiel (b) ‘Edge label (©) , Branch nod ) Branch node (@® None of the above The pr ace requis imi 'e problem of space requirements can be minimized by changing the node structure of trie aS x {.] (®) Binary trie @ Allthe above : (@) Node chain : (6) Hash table ‘found guilty is LIABLE to face LEGAL proceedings. MID -1& 11 mM. mm. (@) 3*Mlog.] +12 (©) @*flog.s] + Dp ; °. eliminates the characters of nodes, ° (a) Compressed trie (b) (©) Suffix trie @ 10 algorithm does not involve any preprocessing phase. (a) Boyer-Moore Algorithm. b) (©) Kauth-Morris-Pratt algorithm . Match the Following 1. Failure function ll @ 2. Boyer-Moore Algorithm tlw 3. Suffix trie C1 © 4. ~ Labeled edge C1 @ 5. Look up operation bd oe KEY Fill in the Blanks 1. Pattern matching + 2. O(mn) 3. O(mn) 4. Prefix 5 Kanith-Morris-Pratt Retrieval Root, External node Two Prefix tree 10. O(mn + [E|) Multiple Choice : a 2) 4, O,. 6. 2 @ 8 © % @ Match the Following © 4 (©) 1) 2 @ a The requirement for aby anch node represented as a binary Wic is atmost 10. “(b), log.r None of the above Binary trie Both (b) and (c) Brute force pattern matching All the above O(m) time ‘To determine repeated characters Compressed trie with an extra field ‘Text Editors Assigns indices @ i “ @ SPECTRUM ALL-IN-ONE JOURNAL FOR ENGINEERING STUDENTS Q3. Qs. O86. o7. a8. a1. a2. a3. 04. Qs. 06. a7. 8. E a a2. 3. a4, ESSAY QUESTIONS WITH KEY UNIT - 1 : Sere sean Define Data structure. Give the classification of data structures. (Unit, @3) Discuss in brief about single linked list. (Units, ag) Define a single linked list. Write the structure of the linked list witha neat sketch. (Unit, q7) Discuss about the stack with examples. (Unit, a14) Write in detail about the applications of stack. (Unit-t, ats) Differentiate between stack and queue. ~ _ (Unit-, a24) Explain the operations of queue. (Unite, Q27) How to construct a queue using stacks? (Unit-1, Q31) ZUNID SM ee ‘How to perform reassign operation on a dictionary? (Unit-1, a3) Explain in detail about skip lists in data structures. (Unit-, a7) Explain the operations of the skip list representation. (Unitl, Q12) Discuss the hash functions. (Unit-II, Q17) Write a C programs to implement different methods of hash functions. What are different methods of collision resolution in hashing? Explain in brief. (Unit-tl, a20) Insert the following list of elements into the hash table by using Quadratic. probing (size of Hash table is 13) 65, 24, 79, 114, 26, 85, 55, 89, 22, 98. (Unit-tI, Q21) Explain in detail about extendible hashing _ UNIT - 1 Explain briefly about binary search trees. (Unit-I1, Q23) (Unit-Ill, Q1) (Unit-t1, Q4) a9) Illustrate search operation on binary search tree. Explain B-tree in detail with an example. | (Uni Discuss briefly about B*-trees. Also; differentiate between Br-trees and B-trees. (unittt, 13) (Unit-I1, Q15) (unit-ill, 16) 25) How Insertion and deletion is done from B*-tree with example? ‘What is balanced binary tree? What are the applications of it. Discuss in detail about red-black trees. What operations are performed on Splay trees? BR BRR M.S UNIT - IV \what are the various operations that can be performed on graphs? Explain. (Unit-tV, Q7) (unit-tV, Q0) (Unit-lV, Q9) (Unitav,at2) (Unitav, 14) (unity, 15) (Unit-tv, @21) (Unit-1v, @22) Write an algorithm to implement a depth-first search with an examplo, Make a comparison of breadth first search and depth first search for a graph. Explain in detail quick sorting method. Provide a complote analysis of quick sort. Explain the process of heap sort with example. Perform heap sort algorithm for (10 15 6 225 18 16 2 20 4). Write briefly about the extemal sorting modél Write an algorithm for merge sort and explain with a suitable example. UNIT-V \ (unit-v, a2) , Q3) mmustrate the Brute force algorithm. (Unit: Explain about Boyer-Moore algorithm in detail. Explain the features that distinguish between Boyer-Moore algorithm from the conventional algorithms. (Unit-V, Q4) ‘Write Knuth-Morris-Pratt pattem matching algorithm. (Unit-V, Q6) Explain in brief about tries with example. (Unit-v, Q9) (Unit-V, Q10) Discuss about Suffix tries. Write an algorithm of Standard Trie. (Unit-v, 013) Difference between tree and tries, (Unit-v, Q17) SPECTRUM @LL-IN-ONE JOURNAL FOR ENGINEERING STUDENTS meant R18 om Jawahartal Nebr Technological University Bech Year 1Semester Examinations EI Apri May ~ 2025 DATA STRUCTURES SBS, CSIT, ITE, CE(SE), CSEICS)- CSE(DS), CSE(OT), CSE(N), Algo, ‘AISML, CSD) Max. Markey = of Part A. Part B. caries et Acancwer all questions. Pan Ais compulons 25 marks tn Pa Pant B Answer any-covc question from each unit, Each du sy have a. b as sub questions ofittions PART—A (25 Marks) nit-, Page No. 15, 011) Give exarplestorsek Ls} (Unit-, Page No. 35, 031) (Unit-tl, Page No. 43,05) restion carries 10 ) (B) How to construct a queue using S © Ww is a skip Est? [2] (List me crawbacks of cpen addressing. [3] + (Unit-Il, Page No. 52, 020) {e) What does the color notate in red-black tree? [2] (Unit, Page No. 85,025 (What operations are performed on Splay trees? [3] (Unit-Ill, Page No. 104, 034) (g) Whats 2 maxheap? [2] (Unit-lV, Page No. 140, 018) (h) Give example for adjacency list of a graph. [3] (Unit-IV, Page No. 112, 05) 0 me. 2] (Unit-V, Page No. 163, 08) @ What are the merits and demerits of brute force method for pattern (Unit-V, Page No. 152,02) matching? [31 PART —B (50 Marks) ‘Write and expiain algorithms for Push and pop operations of stack using Jinked fst. [10] (Unié-1, Page No. 18, 013) OR (2) Describe the conditions of overflow and underflow in a queue. [5] () Discuss the applications of queues. [5] (2) Demonstrate skip list representation of a dictionary. [5] (0) How to perform reassign operation on a dictionary. [5] OR . Explain the algorithm for implementing quadratic probing on a hash table. {10} (Unit, Page No. 33,028) (Unit-1, Page No. 34, 030) (Unit-Il, Page No. 45, 08) (Unit-Il, Page No. 42, 03) (Unit-Il, Page No. 52, 020) (a) Illustrate search operation on binary search tree. [5] (Uni ’age'No. 68, 04) (b) Discuss the importance of height balanced trees for searching. [5] _(Unit-lIl, Page No. 82, 016) OR (2) With suitable examples, illustrate right-left rotation on AVL tree. [5] (Unit-I1, Page No. $0, 022) (b) Differentiate between splay tree and red-back tree. [5] (Unit-lll, Page No. 106, 038) Make a Comparison of breadth first search and depth first search for . a graph. graph. [10] (Unit.1V, Page No. 118, 03) ; ; OR ‘Write an algorithm for merge sort and explain with a suitable example. [10] (Unit 1V, Page No. 143, 022) Describe the Knuth-Morris-Pratt algorithm for pattern matching. [10] (Univ, Page No. 156, 06) OR ‘A compressed trie is an advanced version of the standard trie.” ‘Support or ‘oppose this statement with necessary explanation. [10] nit SPECTRUM @LL-IN-ONE JOURNAL FOR ENGINEERING STUDENTS Page No. 167, 011) gP2. DATA STRUCTURES [JNTU-HYDERABAD] Anwrbharial Netra Technological Untwersity Hyderabad R1 8 March - 2022 DATA STRUCTURES (Common te CSE. IT. ECM, C888, cSt iE, CSE(SE), CSE(CS), CSE(AIML), CSE(DS), CSE(IOT), CSEN) Time. 3 Hours “Max. Marks: 75 Anywer any five questions All questions carry equal marks Solutions 1. (@) Define a single linked list. Write the structure of the linked list with a neat sketch. (Unit, Page No. 7. 07) () Explain the operations of queue (Unit, Page Mo. 33, 027) 2. (2) Write a program to implement stack operations (Units, Page No. 16, 012) (®) What are the applications of the queue? Explain. (Unit, Page No. 34, 030) 3. (2) _ Explain the operations of the skip list representation. (Unit, Page No. 48, 012) (®) Is linear probing and open addressing same? Justify your answer. (Unit l, Page No. $2, 020) 4. (2) Discuss the hash functions. (Unit, Page No. 50, 017) (©) List and explain the advantages of extendible hashing. (Unit, Page No. 60, 023) 5. (a) Construct a Red-Black tree with the following elements 40, 16, 36, 54, 1%, 7, 48, 5. Delete element 18 and add element 66. (Unit, Page No. 101, 031) (>) Write an algorithm of single rotation and double rotation of an AVL tree. (Unitll, Page No. 84, 018) 6. (a) Explain the splaying operations of splay tree with an example. (Unit-ll, Page No. 104, 034) (b) Define Binary search tree. (Unit-lll, Page No. 66, Q1) 7. (a) Write an algorithm to implement a depth-first search with an example, (Unit lV, Page No. 115, 08) + (b) Perform heap sort algorithm for (10 15 6 2 25 18 16 2 204). (Unit-V, Page No. 130, 015) $ (a) Difference between tree and tries. (Unit-V, Page No. 176, 017) (6) Asia the Brute force algorithm. (nit, Page No. 152, 02) ‘ox/Photocopying of this book Is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings. Jawaharlal Nehru Technologleal Univerally Hyderabad B.Tech Il Yoar | Semostor Examinations Em September = 2021 DATA STRUCTURES (Common to GSE, IT, ITE) Time: 3 Hours Max, Marke Answer any five questions All questions carry equal marks ee ‘olutions jons on a stack. (Units, Page No. 18,053 1. (@)_ Write an algorithm of Push and Pop op (©) Differentiate between stack and queue. (Unit, Page No. 28, a2¢, 2 Insert the following list of elements into the hash table by using Quadratic probing (size of Hash table is 13) 65, 34, 79, 114, 26, 85, 55, 89, 22, 98. (Unit-Il, Page Mo. 56, 02%) Insert the following list of elements from the Red-Black tree. Delete the elements 18, 2 and 30 from the Red-Black tree 12, 30, 36, 18, 25, 9, 4, 2, 17, 14,20, 47. . (Unit.I1, Page No. 98, 02%) 4. Sort the following list of elements by using Merge sort 30, 56, 78, 99, 12, 43, 10, 24, 85. (Unit-4V, Page No. 146, 023) 5... @)_ Write an algorithm of Standard Trie. ‘ (Unit-V, Page No. 169, 013) (©) Explain the features that distinguish between Boyer-Moore algorithm from the conventional algorithms. 4 (Unit-V, Page No. 156, 04) 6 (a)_ Write an algorithm for insertion of node at last position in Linear Linked us a (Units, Page No. 8,08 (b) Evaluate the following postfix expression using stack. Show each step 534+62/*35*+. (Unit-1, Page No. 26, 021) 7. Write an algorithm of skip list operations insertion and deletion. (Unitstl, Page No. 47, 011) 8. Explain the operations of Splay tree with an example. (Unit-IIl, Page No, 104, 034) gpP.4 DATA STRUCTURES [JNTU-HYDERAEAD) Ce Time: 3 Hours ode No : 153AK Jowaharlal Nehru Technological University Hyderabad R 1 8 ‘ B.Toch il Year | Semester Examinations March 2021 DATA STRUCTURES (Common to CSE, IT, TE) Max. Marks: 75 Answer any five questions All questions carry equal marks o Solutions (@) Discuss in brief about single linked list. (Units, Page Mo. 5, 05) (®) _ Write aC program to convert infix to postfix expression. (Units, Page No. 24, 012) What are different methods of collision resolution in hashing? Explain in brief. (Unitll, Page Mo.52, 020) (@) "Discuss in detail aboist red-black trees, (Unitall, Page We. $5, O25) (©) Explain briefly about binary search trees. * (Unit ll, Page Mo. £5, 01) How a graph is traversed using depth first search? Explain with example. (Unit-4V, Page No. 115, 02) Explain the process of heap sort with example. : (Unit V, Page No. 125, 014) Explain in brief about tries with example. (Unit-V, Page No. 153, 05) Compare and contrast different sorting methods. (Unit-1V, Page No. 142, 025) Explain in detail about skip lists in data structures. zs (Unit, Page Mo. 45,07) ‘found guilty is LIABLE to face LEGAL proceedings. Code No : 153AK Jawaharlal Nehru Technological University Hyderabad RI] 8 B.Tech II Year | Semester Examinations December - 2019 DATA STRUCTURES (Common to CSE, IT) Max. Time: 3 Hours Marks 3 6. 10. Note: This question paper contains two Parts A and B. Part A is compulsory which carries 25 marks. Answer all questions in Part A. Part B consists of § Units. Answer any one full question from each unit 10 marks and may have a, b as sub questions. Each question ca PART- A. (25 Marks) ‘olutions (a) _ Explain how does linked stack differ from a linear stack. (nits, Page No. 18, ay (b) Define searching. » (Unit, Page No.3, a2, (c) How many binary trees are possible with four nodes? (Unit-I, Page No. 68, 03) (a) Define tree traversal. (Unit-IHl, Page No. 66,02) (©) What is pattem? i (Unit-V, Page No. 152, a4) (8) Write the pseudocode for reversing the List using Stacks, (Unit, Page No. 15, 011) (g) Discuss about linear probing. * (Unit-ll, Page No. 52, 020) (h) Write about splay trees. : (Unit-tl, Page No. 104, 034) (i) What is Graph? Define degree of vertex. . (Unit-1V, Page No. 110, 02) (i) Write a short notes on standard tries. (Unit-V, Page No. 164, 010) PART - B (50 Marks) What is priority queue? Explain the implementation of priority queue. Write an algorithm for operations of priority queues. (Wnit-1, Page No. 36, 032) . OR (a) Discuss about the stack with examples, (Unit-1, Page No. 15, 011) (6) Write an algorithm to implement queue using stack. (Unit-, Page No. 35, 031) ‘What is collision? Explain different collision resolution techniques with examples. Wnit-t1, Pago No. 52, 020) oR Describe the operations of skip list with an example. (Unit-Il, Page No. 48, 012) Write an algorithm for creation of binary tree using in-order traversal and post order traversals. (Unit-IIl, Page No. 66, 02) or Construct the AVL tree of the following data, 38, 40, 50, 2, 5, 76, 25, 14, 7: (Unit-II1, Page No. 89, 021) How to represent graphs? Explain, UnitV, Page No. 112, 05) or Explain Heap sort algorithm, Create Heap for the following elements and then sort thein. (13, 102, 405, 136, 15, 105, 390, 432, 28, 444), (@) Explain about Boyer-Moore algorithm in detail, (b) Discuss about Suffix tries, (Unit-1V, Page No. 135, 017) (Unit-V, Page No. 153, 03) (Unit-V; Page No. 164, 010) OR Write Knuth-Morris-Pratt pattern matching algorithm. (Unit-V, Page No. 156, 06) SPECTRUM ALL-IN-ONE JOURNAL FOR ENGINEERING STUDENTS Joe 3 Hoss BcTech. ll Year | Semester Examination Paes | 1 DATA STRUCTURES © NS CSE. IE CEISE). CSE{CS), CSE(DS), CSE(ANRML), CSETIOT), CSE(N), AIKDS, AKSML. CSD, CSBS and CST) Max, Marks: 60 " 5. 10. n ® ®) © fe) ° ® i) a ) @ ©) @) 2 @ @) @) ©) (a) ©) (2) (b) (a) (b) (a) (b) fa) ) PART-A_ (10s t= 10 Marks) ‘Solutions oe ai pe eek (Waitt, Page No, 38, 04) eee aa fanrea re used in computers. (Unit, Page No, 38, 06) Gye an exarele for dotal (Unit tl Page No. 63, 03) Ust any two OR enelysis method (Unit ML Page No. 63, 07) vy two Properties of AVL tree? (Unit-II1, Page No. 107, 03) cies 19 No, 107, 02) No. 149, 02) No. 149, 07) OsFerentiate Grected graph from undirected graph. Write the principle of selection sort What is the height of a trie? (Unit-V, Page No. 177, 05) Define 2 compressed trie with skip fields. (Unit-V, Page No, 177, 07) PART-B (5x 10 = 50 Marks) Define Data structure. Give the classification of data structures. (Unit-1, Page No. 2, 01) Discuss about the stack with examples. (Unit. No. 15, 011) OR Expisin the ‘operations of queue. (Unit-1, Page No. 33, 027) Define 2 single linked list. Write the structure of the linked list with @ neat sketch. (Unit-1, Page No. 7, Q7) xpizin the operations of the skip list representation. (Unit-l, Page No. 48, 012) Explain in detail about extendible hashing. (Unit-Il, Page No. 60, 023) OR Discuss the hash functions. (Wnit-II, Page No. 50, Q17) Insert the following list of elements into the hash table by using Quadratic probing (size of Hash table is 13) 65, 34, 79, 114, 26, 85, 55, 89, 22, 98. (Unit-II, Page No. 56, 021) Explain briefly about binary search trees. (Unit-Ill, Page No. 66, 01) How insertion and deletion is done from B*-tree with example? (Unit-Ill, Page No. 79, 015) OR Explain B-tree in detail with an example. : (Unit-tll, Page No. 74, 039) Discuss in detail about red-black trees. (Unittll, Page No. 95, 025) Write an algorithm to implement a depth-first search with an. (Unit example. : Page No. 115, 08) Write an algorithm for merge sort and explain with a suitable example. (Wait v, Pag No, 143, 022) OR Explain the process of heap sort with example. (Unitv, Pai What are the various operations that can be performed on graphs? Explain. Explain about Boyer-Moore algorithm in detail Write Knuth-Morris-Pratt pattern matching algorithm. OR No, 126, 014) (UnitV, Page No. 114, 07) (WnitV, Page No. 153, 03) (Unit-V, Page No. 156, 06) Discuss about Suffix tries. (Unit-v, Page No. 164, 010) Write an algorithm of Standard Trie. (Unit-V, Page No. 169, 013) ‘SPECTRUM @LL-IN-ONE JOURNAL FOR ENGINEERING STUDENTS

You might also like