Download as pdf
Download as pdf
You are on page 1of 2
23.4 Wirite an algorithm to convert an infix expression to postfix expression 8 4 > ‘Trace the algorithm to convert the infix expression a+b + cidtelf to @ postfix expression. (oR) ’. Give algorithms for push and pop operations on stack using a linked list © 7 9? ‘with suitable pictorial representations. 24, Write appropriate algorithm for inserting and deleting a node in a binary * search toe. (oR) bi. Create a Bete of order ~ 5 forthe following data arriving in sequence 90, 4 4 #2 27, 7,9, 18,21, 3,4, 16, 1,21, 72 fi, Compare BST with AVL toe. fehee 25.2, Consider the graph given below show its adjacency list and adjacency * #2 matrix in the memory. A——>B I> cp (or) >, IMhustrate Kruskal’s algorithm to find the minimum spanning tee of a * * # raph, PART-€ (1 x15 = 15 Marks) sas mt co 10 ‘Answer ANY ONE Questions 26. Consider a hash table with 9 slols. The hash function is) = k mod 9. ‘The following keys are inserted in order 5, 28, 19, 15, 20, 33, 12,17, 10 Draw the contents of the hash table when the collisions are solved by i. Chaining ii, Linear probing iii, Double hashing, The second hash function (x)= 7 (2267). 27. Apply an appropriate algorithm to find the shortest path from “A” to every ‘other node of A. For the given graph, Note: 0 @ ‘Time: 3 Hours | Reg, No. B.Tech, DEGREE EXAMINATION, MAY 2023, “Third Semester 2ICSC2011- DATA STRUCTURES AND ALGORITHMS (or the candidates admitted from the academie year 2022-2025 onwards) Part A shouldbe answered in OMR sheet withia fist 40 minutes and OMR sheet shouldbe handed over hal invigilator athe end of 40° minute Part= Band Part-C should be answered in answer booklet PART A 20 x1=20Marks) ‘Answer ALL Questions How do you instantiate an array in C? (B) int Arr{ 3]; (D) int An() = New int [3]; ements in an array are accessed (A), Randomly (©) Exponentially (B) Sequentially (D) Logarithmically Which of the following data structure is non linear type? (A) Strings ®) Lists (©) Stacks (D) Hierarchical ‘What willbe the output of the following code? struct student struct student *S ; { SC = “HELLO" CHAR; | print*94S", SC); B } ‘void main() | { (A) Hello (©) Runtime exror (B) Segmentation fault (D) Nothing, Linked list data stricture offers considerable saving in (A), Computational ime (B) Space utilization (©) Space utilization and (D) Speed utilization computational time Which of the following is false about a doubly linked list?” : (A) We can navigate in both the (B) It requires more space than a directions singly linked list (©) The insertion and deletion of @ (D) Implementing a doubly linked node take a bit longer ime Tit iy easier Ua singly Hnked list 12, 1. 14 1. . Which ofthe following is false about a circular linked list? (A) Bvery node has successor (B) Time complexity of inserting a new node at the head ofthe list is OM) (©) The complexity for deleting (D) We can traverse the whole the last node is O(0). circular linked list, starting ‘rom any point ‘Which ofthese is not an application of a linked list? (A) Toimplement filesystem (B) For separate chaining in hash- tables (©) Toimplement non-binary trees (D) Random access of elements ‘The data structure required to check whether an expression contains balanced parenthesis is (A) Stack (B) Queue (©) Amy (D) Tree ‘The prefix form of A-B / (C*DAE) is? () “PAACBDE (B) -ABCD* ADE (© -ABCADE (D) -A/BC*ADE A quetie follows (A) FIFO (Fit ia First Ou) (B) LIFO (Last in First Out) principle prineipte (©) Ordered array (©) Linear tee ‘A normal queue, if implemented using an array of size max-size gets full ‘when? (A) Rear= Max~size~1 (©) Front= Rear +1 (B) Front= (wear-+1) mod max size () Rear= Front A Linear list of elements in which deletion ean be done from one end (front) ‘nd insertion can take place only atthe other end (rear) is known as, (A) Queue (B) Stack © Tre (D) Tinked lst ‘What is a full binary tree? (A) Fach node hus exactly zero or (B) Each node has exactly two two children children (©) Ail the leaves are at the same (D) Each node has exactly one oF level ‘wo children For the binary toe, find the pre order traversal sequence GQ © 2 ©® © @®@® O® rvsacseans 16. 19. 20, dha, 2a, eet (A) HIDEGFIKGCA (© ABDHIECFGIK (@®) HDIBEAFCIGK (©) ABCDEFGHIJK ‘What is direct addressing? (A) Distinet array position for (B) Fewer array positions than keys every possible (©) Fewer keys than array (D) Same array positions for all positions keys ‘What data organization method is sed in Hash tables? (A) Stack (B) Amy (©) Linked tist () Queue ‘What would be the number of zeros in the adjacency matrix of the given raph? ® 10 B) 6 © 16 0 ‘The traveling salesman problem can be solved using (A) A spanning tree (C) Bellman —Ford algorithin (B) A minimum spanning tee () DFS taversal DUKSTRA’s algorithm is used to solve___problem (A): Allpaic shortest path (B) Single source shortest path (©) Network flow (D) Sorting PART —B (Sx8 = 40 Marks) ‘Answer ALL Questions Define a function to multiply two m x 1 matrices and return the resultant matrix. (oR) How mathematical notations are used to measure the complexity of the algorithm? Explain diferent notations used, Write an algorithm to demonstrate @ polynomial equation using linked list {or subtraction of two polynomials equations. (oR) Consider an array A[1:n] Given 8 positon, write an algorithm to inser an clement in the array. Ifthe position is empty, the element is inserted easly If the postion is already occupied the element should be inserted with the ‘minimum number of shifts (Note: The elements can shift to the left or to the right to make the minimum number of moves).

You might also like