S.SAKTHI, LECTURER/IT

Size: px
Start display at page:

Download "S.SAKTHI, LECTURER/IT"

Transcription

1 NH 67, Karur Trichy Highways, Puliyur C.F, Karur District DATA STRUCTURES AND ALGORITHMS QUESTION BANK PREPARED BY: S.SAKTHI-LECTURER/IT BRANCH/YEAR: EEE/II UNIT-I (LINEAR STRUCTURES) 1. What is meant by an abstract data type? An ADT is a set of operation. Abstract data types are mathematical abstractions.eg.objects such as list, set and graph along their operations can be viewed as ADT's. 2. What are the operations of ADT? Union, Intersection, size, complement and find are the various operations of ADT. 3. What is meant by list ADT? List ADT is a sequential storage structure. General list of the form a1, a2, a3.., an and the size of the list is 'n'. Any element in the list at the position I is defined to be ai, ai+1 the successor of ai and ai-1 is the predecessor of ai. 4. What are the various operations done under list ADT? Print list Insert Make empty Remove Next Previous Find kth 5. What are the different ways to implement list? Simple array implementation of list Linked list implementation of list 6. What are the advantages in the array implementation of list? a) Print list operation can be carried out at the linear time b) Fint Kth operation takes a constant time

2 7. What is a linked list? Linked list is a kind of series of data structures, which are not necessarily adjacent in memory. Each structure contain the element and a pointer to a record containing its successor. (OR) The linked list consists of a series of structures, which are not necessarily adjacent in memory. Each structure contains the element and a pointer to a structure containing its successor. We call this the next pointer. 8. What is a pointer? Pointer is a variable, which stores the address of the next element in the list. Pointer is basically a number. 9. What are different types of Linked List? Single linked list Double linked list Circular linked list 10. What are different types of Circular Linked List? Circular Single linked list Circular double linked list 11. List the basic operations carried out in a linked list? a. Creation of list b. Insertion of list c. Deletion of list d. Modification of list e. Traversal of List 12. Define double linked list? It is linear data structure which consists of two links or pointer fields Next pointer points to the address of the next(successor) node.previous pointer points to the address of the previous(predecessor) node. 13. What is a doubly linked list? In a simple linked list, there will be one pointer named as 'NEXT POINTER' to point the next element, where as in a doubly linked list, there will be two pointers one to point the next element and the other to point the previous element location.

3 14. Define double circularly linked list? In a doubly linked list, if the last node or pointer of the list, point to the first element of the list, then it is a circularly linked list. 15. Define Circular linked list? It is a list structure in which last node points to the first node, there is no null value. 16. What is the need for the header? Header of the linked list is the first element in the list and it stores the number of elements in the list. It points to the first data element of the list. 17. List three examples that uses linked list? Polynomial ADT Radix sort Multi lists 18. Give some examples for linear data structures? Stack Queue 19. What is a stack? Stack is a data structure in which both insertion and deletion occur at one end only. Stack is maintained with a single pointer to the top of the list of elements. The other name of stack is Last-in -First-out list. 20. Write postfix from of the expression A+B-C+D? A-B+C-D+ 21. How do you test for an empty queue? To test for an empty queue, we have to check whether READ=HEAD where REAR is a pointer pointing to the last node in a queue and HEAD is a pointer that pointer to the dummy header. In the case of array implementation of queue, the condition to be checked for an empty queue is READ<FRONT. 22. What are the postfix and prefix forms of the expression? A+B*(C-D)/(P-R) Postfix form: ABCD-*PR-/+ Prefix form: +A/*B-CD-PR

4 23. Explain the usage of stack in recursive algorithm implementation? In recursive algorithms, stack data structures is used to store the return address when a recursive call is Encountered and also to store the values of all the parameters essential to the current state of the procedure. 24. Write down the operations that can be done with queue data structure? Queue is a first - in -first out list. The operations that can be done with queue are addition and deletion. 25. What is a circular queue? The queue, which wraps around upon reaching the end of the array is called as circular queue. 26. Write down the definition of data structures? A data structure is a mathematical or logical way of organizing data in the memory that consider not only the items stored but also the relationship to each other and also it is characterized by accessing functions. 27. Give few examples for data structures? Stacks, Queue, Linked list, Trees, graphs 28. Define Algorithm? Algorithm is a solution to a problem independent of programming language. It consist of set of finite steps which, when carried out for a given set of inputs, produce the corresponding output and terminate in a finite time. 29. What are the features of an efficient algorithm? Free of ambiguity Efficient in execution time Concise and compact Completeness Definiteness Finiteness 30. List down any four applications of data structures? Compiler design Operating System Database Management system Network analysis

5 31. What is meant by an abstract data type(adt)? An ADT is a set of operation.a useful tool for specifying the logical properties of a datatype is the abstract data type.adt refers to the basic mathematical concept that defines the datatype. Eg.Objects such as list, set and graph along their operations can be viewed as ADT's. 32. What is a Stack? A Stack is an ordered collection of items into which new items may be inserted and from which items may be deleted at one end, called the top of the stack. The other name of stack is Last-in -First-out list. 33. What are the two operations of Stack? PUSH POP 34. Write postfix from of the expression A+B-C+D? A-B+C-D+ 35. What is a Queue? A Queue is an ordered collection of items from which items may be deleted at one end called the front of the queue and into which tems may be inserted at the other end called rear of the queue.queue is called as First in-first-out(fifo). 36. Mention applications of stack? a. Expression parsing b. Evaluation of Postfix c. Balancing parenthesis d. Tower of Hanoi e. Reversing a string 37. Deletion routine for linked lists: void delete( element_type x, LIST L ) { position p, tmp_cell; p = find_previous( x, L ); if( p->next!= NULL ) /* Implicit assumption of header use */ { /* x is found: delete it */ tmp_cell = p->next; p->next = tmp_cell->next; /* bypass the cell to be deleted */ free( tmp_cell ); } }

6 38. Insertion routine for linked lists void insert( element_type x, LIST L, position p ) { position tmp_cell; tmp_cell = (position) malloc( sizeof (struct node) ); if( tmp_cell == NULL ) fatal_error("out of space!!!"); else { tmp_cell->element = x; tmp_cell->next = p->next; p->next = tmp_cell; } } 39. Examples Of Linked List: The Polynomial ADT Multilists Radix sort 40. STACK: A stack is a list with the restriction that inserts and deletes can be performed in only one position, namely the endof the list called the top. The fundamental operations on a stack are push, which is equivalent to an insert, and pop,which deletes the most recently inserted element. Stacks are sometimes known as LIFO (last in, first out) lists. Stack model: input to a stack is by push, output is by pop 41. Applications of Stacks: Balancing Symbols Infix to Postfix Conversion Postfix Expressions

7 42. Routine to test whether a stack is empty--array implementation int is_empty( STACK S ) { return( S->top_of_stack == EMPTY_TOS ); } 43. Routine to create an empty stack--array implementation void make_null( STACK S ) { S->top_of_stack = EMPTY_TOS; } 44. Routine to push onto a stack--array implementation void push( element_type x, STACK S ) { if( is_full( S ) ) error("full stack"); else S->stack_array[ ++S->top_of_stack ] = x; } 45. Routine to return top of stack--array implementation element_type top( STACK S ) { if( is_empty( S ) ) error("empty stack"); else return S->stack_array[ S->top_of_stack ]; } 46. Routine to pop from a stack--array implementation void pop( STACK S ) { if( is_empty( S ) )

8 error("empty stack"); else S->top_of_stack--; } 47. QUEUE: The basic operations on a queue are enqueue, which inserts an element at the end of the list (called the rear), and dequeue, which deletes (and returns) the element at the start of the list (known as the front). Model of a queue 48. Applications of QUEUE: When jobs are submitted to a printer, they are arranged in order of arrival. Thus, essentially, jobs sent to a line printer are placed on a queue. Virtually every real-life line is (supposed to be) a queue. For instance, lines at ticket counters are queues, because service is first-come first-served. Another example concerns computer networks. There are many network setups of personal computers in which the disk is attached to one machine, known as the file server. Users on other machines are given access to files on a first-come first-served basis, so the data structure is a queue. Calls to large companies are generally placed on a queue when all operators are busy.in large universities, where resources are limited, students must sign a waiting list if all terminals are occupied. The student who has been at a terminal the longest is forced off first, and the student who has been waiting the longest is the next user to be allowed on. Applications of QUEUE: Real life line Calls to large companies Access to limited resources in Universities Accessing files from file serve Jobs submitted to printer

9 PART-B 1. Explain the linked list implementation of list ADT in Detail? Definition for linked list Figure for linked list Next pointer Header or dummy node Various operations Explanation Example figure Coding 2. Explain the cursor implementation of linked list? Definition for linked list Figure for linked list Next pointer Header or dummy node Various operations Explanation Example figure Coding 3. Explain the various applications of linked list? Polynomical ADT Operations Coding Figure Radix Sort Explanation Example Multilist Explanation Example figure 4. Explain the linked list implementation of stack ADT in detail? Definition for stack Stack model Figure Pointer-Top Operations Coding Example figure

10 5. Explain the array implementation of queue ADT in detail? Definition for stack Stack model Figure Pointer-FRONT, REAR Operations Coding Example figure 6. Explain singly linked list in detail. Definition, insert, deletion-routine, diagram 7. Explain doubly linked list in detail. Definition, insert, deletion-routine, diagram 8. Discuss the applications of stacks in brief. Balancing Symbols Infix to Postfix Conversion Postfix Expressions 9. Discuss various implementation of list in brief. Linked list implementation (stack, queue) Array implementation (stack, queue) Cursor implementation 10.Discuss briefly about array and linked list implementation for stack. 11. What are the various operations performed by singly linked list? 12. Write an algorithm for inserting and deleting an element from doubly linked list 13. What is a Stack? Explain with example. Definition of Stack Operations of Stack:PUSH and POP Example 14. Write a program to print out the elements of a singly linked list.

11 15. Given two sorted lists, L1 and L2, write a procedure to compute L1 L2 using only the basic list operations. 16. Given two sorted lists, L1 and L2, write a procedure to compute L1 L2 using only the basic list operations. 17. Write a program to evaluate a postfix expression. 18. Write the routines to implement queues using linked lists arrays 19. A deque is a data structure consisting of a list of items, on which the following operations are possible: push(x,d): Insert item x on the front end of deque d. pop(d): Remove the front item from deque d and return it. inject(x,d): Insert item x on the rear end of deque d. eject(d): Remove the rear item from deque d and return it. Write routines to support the deque that take O(1) time per operation.

12 UNIT-II (TREE STRUCTURES) 49. Define non-linear data structure? Data structure which is capable of expressing more complex relationship than that of physical adjacency is called non-linear data structure. 50. Define tree? A tree is a data structure, which represents hierarchical relationship between individual data items. 51. Define leaf? In a directed tree any node which has out degree o is called a terminal node or a leaf. 52. What is meant by directed tree? Directed tree is an acyclic diagraph which has one node called its root with indegree o whille all other nodes have indegree I. 53. What is a ordered tree? In a directed tree if the ordering of the nodes at each level is prescribed then such a tree is called ordered tree. 54. What is a Binary tree? A Binary tree is a finite set of elements that is either empty or is partitioned into three disjoint subsets.the first subset contains a single element called the root of the tree.the other two subsets are themselves binary trees called the left and right subtrees. 55. What are the applications of binary tree? Binary tree is used in data processing. a. File index schemes b. Hierarchical database management system 56. What is meant by traversing? Traversing a tree means processing it in such a way, that each node is visited only once. 57. What are the different types of traversing? The different types of traversing are a. Pre-order traversal-yields prefix from of expression. b. In-order traversal-yields infix form of expression. c. Post-order traversal-yields postfix from of expression.

13 58. What are the two methods of binary tree implementation? Two methods to implement a binary tree are, a. Linear representation. b. Linked representation 59. Define pre-order traversal? Pre-order traversal entails the following steps; a. Visit the root node b. Traverse the left subtree c. Traverse the right subtree 60. Define post-order traversal? Post order traversal entails the following steps; a. Traverse the left subtree b. Traverse the right subtree c. Visit the root node 61. Define in -order traversal? In-order traversal entails the following steps; a. Traverse the left subtree b. Visit the root node c. Traverse the right subtree 62. What is the length of the path in a tree? The length of the path is the number of edges on the path. In a tree there is exactly one path form the root to each node. 63. Define expression trees? The leaves of an expression tree are operands such as constants or variable names and the other nodes contain operators. 64. Define Strictly binary tree? If every nonleaf node in a binary tree has nonempty left and right subtrees,the tree is termed as a strictly binary tree. 65. Define complete binary tree? A complete binary tree of depth d is the strictly binary tree all of whose are at level d. 66. What is an almost complete binary tree? A binary tree of depth d is an almost complete binary tree if : Each leaf in the tree is either at level d or at level d-1

14 For any node nd in the tree with a right descendant at level d, all the left descendants of nd that are leaves are at level d. 67. TREE: A tree can be defined in several ways. One natural way to define a tree is recursively. A tree is a collection of nodes. The collection can be empty, which is sometimes denoted as A. Otherwise, a tree consists of a distinguished node r, called the root, and zero or more (sub)trees T1, T2,..., Tk, each of whose roots are connected by a directed edge to r.the root of each subtree is said to be a child of r, and r is the parent of each subtree root. Figure-1 shows a typical tree using the recursive definition. FIGURE-1 Generic tree From the recursive definition, we find that a tree is a collection of n nodes, one of which is the root, and n - 1edges. That there are n - 1 edges follows from the fact that each edge connects some node to its parent, and every node except the root has one parent A tree

15

16 68. Find first child /next siblings for above figure: ANSWER:

17

18 69. Expression Tree traversals Inorder traversal produces infix notation. This is a overly parenthesized notation. Print out the operator, then print put the left subtree inside parentheses,and then print out the right subtree inside parentheses. Postorder traversal produces postfix notation. Print out the left subtree, then print out the right subtree, and then printout the operator. Preorder traversal produces prefix notation. Print out the operator, then print out the right subtree, and then print out the left subtree. 70. Constructing an expression tree STEPS:

19 71. Binary Search Trees (BST) 72. Operations on BSTs

20 73. For the tree in Figure 4.63 : a. Which node is the root? b. Which nodes are leaves? 74. For each node in the tree of Figure 4.63 : a. Name the parent node. b. List the children. c. List the siblings. d. Compute the depth. e. Compute the height. 75. What is the depth of the tree in Figure 4.63? 76. (a)show the result of inserting 3, 1, 4, 6, 9, 2, 5, 7 into an initially empty binary search tree. (b)show the result of deleting the root.

21 77. Give the prefix, infix, and postfix expressions corresponding to the tree in Figure PART-B 1) Explain the different tree traversals with an application? 2) Define binary search tree? Explain the various operations with an example? 3) Write the function to insert, find and delete an element from a binary search tree. 4) What is a Binary tree? Explain Binary tree traversals in C? 5) Explain Representing lists as Binary tree? Write algorithm for finding K th element and deleting an element? 6) Discuss expression tree in brief. 7) Write an insert, delete, findmin, findmax, find routine for Binary search tree. 8) Write routines to implement the basic binary search tree operations.

22 UNIT-III (BALANCED SEARCH TREES AND INDEXING) 78. Define AVL tree AVL tree also called as height balanced tree.it is a height balanced tree in which every node will have a balancing factor of 1,0,1. Balancing factor of a node is given by the difference between theheight of the left sub tree and the height of the right sub tree. 79. Define Balancing factor Balancing factor of a node is given by the difference between the height of the left sub tree and the height of the right sub tree. BF=H l -H r where H l is the height of the left sub tree and H r is the height of the right sub tree 80. What are the various transformation performed in AVL tree? single rotation - single L rotation - single R rotation double rotation -LR rotation -RL rotation 81. What is meant by pivot node? The node to be inserted travel down the appropriate branch track along the way of the deepest level node on the branch that has a balance factor of +1 or -1 is called pivot node. 82. What is priority queue? A priority queue is a data structure that allows at least the following two operations: insert which does the obvious thing; and Deletemin, which finds,returns, and removes the minimum element in the priority queue. The Insert operation is the equivalent of Enqueue. Basic model of a priority queue

23 83. Applications of priority queues for scheduling purpose in operating system used for external sorting important for the implementation of greedy algorithm, which operate by repeatedly finding a minimum. 84. What are the main properties of a binary heap? Structure property Heap order property 85. Various implementation of binary heap/priority queue: Linked list, Binary search tree 86. Structure Property A heap is a binary tree that is completely filled, with the possible exception of the bottom level, which is filled from left to right. Such a tree is known as a complete binary tree A complete binary tree 87. Heap Order Property In a heap, for every node X, the key in the parent of X is smaller than (or equal to) the key in X, with the obvious exception of the root (which has no parent). In Figure: 2 the tree on the left is a heap, but the tree on the right is not (the dashed line shows the violation of heap order)

24 88. Basic Heap Operations: Insert Delete_min Decrease_key Increase_key Delete Build_heap Figure: 2 Two complete trees (only the left tree is a heap) 89. Insert HEAP: To insert an element x into the heap, we create a hole in the next available location, since otherwise the tree will not be complete. If x can be placed in the hole without violating heap order, then we do so and are done. Otherwise we slide the element that is in the hole's parent node into the hole, thus bubbling the hole up toward the root. We continue this process until x can be placed in the hole.

25 90. Delete_min HEAP: Delete_mins are handled in a similar manner as insertions. Finding the minimum is easy; the hard part is removing it. When the minimum is removed, a hole is created at the root. Since the heap now becomes one smaller, it follows that the last element x in the heap must move somewhere in the heap. If x can be placed in the hole, then we are done. This is unlikely, so we slide the smaller of the hole's children into the hole, thus pushing the hole down one level. We repeat this step until x can be placed in the hole. Thus, our action is to place x in its correct spot along a path from the root containing minimum children. In FIG:1 the left figure shows a heap prior to the delete_min. After 13 is removed, we must now try to place 31 in the heap. 31 cannot be placed in the hole, because this would violate heap order. Thus, we place the smaller child (14) in the hole, sliding the hole down one level (see Fig. 6.10). We repeat this again, placing 19 into the hole and creating a new hole one level deeper. We then place 26 in the hole and create a new hole on the bottom level. Finally, we are able to place 31 in the hole (Fig. 6.11). This general strategy is known as a percolate down. We use the same technique as in the insert routine to avoid the use of swaps in this routine. FIG:1 Creation of the hole at the root

26 91. What is the need for hashing? Hashing is used to perform insertions, deletions and find in constant average time. 92. Define hash function? Hash function takes an identifier and computes the address of that identifier in the hash table using some function. 93. List out the different types of hashing functions? The different types of hashing functions are, a. The division method b. The mind square method c. The folding method d. Multiplicative hashing e. Digit analysic 94. What are the problems in hashing? a. Collision b. Overflow 95. What are the problems in hashing? When two keys compute in to the same location or address in the hash table through any of the hashing function then it is termed collision. 96. General idea of hashing and what is the use of hashing function: A hash table similar to an array of some fixes size-containing keys. The keys specified here might be either integer or strings, the size of the table is taken as table size or the keys are mapped on to some number on the hash table from a range of 0 to table size

27 97. HASH FUNCTION: H(X) = X MOD TABLESIZE 98. Show the result of inserting 2, 1, 4, 5, 9, 3, 6, 7 into an initially empty AVL tree. 99. Open Hashing (Separate Chaining) is to keep a list of all elements that hash to the same value Eg: 0,1,4,25,16,9,49,36,64,81 H(X) = X MOD TABLESIZE Hash(x) = x mod 10. Open hashing has the disadvantage of requiring pointers Closed Hashing (Open Addressing) Closed hashing, also known as open addressing, is an alternative to resolving collisions with linked lists. In a closed hashing system, if a collision occurs, alternate cells are tried until an empty cell is found Three common collision resolution strategies of Closed Hashing (Open Addressing): Linear Probing Quadratic Probing Double Hashing

28 102. Linear Probing In linear probing, is a linear function of i, typically (i) = i. This amounts to trying cells sequentially (with wraparound) in search of an empty cell Quadratic Probing Quadratic probing is a collision resolution method that eliminates the primary clustering problem of linear pro bing. Quadratic probing is what you would expect-the collision function is quadratic. The popular choice is f (i) = i Double Hashing For double hashing, one popular choice is f(i) = i* h2(x). (ie) h1(x)=x mod tablesize h2(x) = R - (x mod R), with R a prime smaller than tablesize, 105. Primary clustering Primary clustering means that any key that hashes into the cluster will require several attempts to resolve the collision, and then it will add to the cluster Properties of B-tree: A B-tree of order m is a tree with the following structural properties: The root is either a leaf or has between 2 and m children. All nonleaf nodes (except the root) have between m/2 and m children. All leaves are at the same depth A B-tree of order 4 is more popularly known as a tree, and a B-tree of order 3 is known as a 2-3 tree Show the result of inserting the following keys into an initially empty 2-3 tree: 3, 1, 4, 5, 9, 2, 6, 8, 7, Show the result of inserting 10, 12, 1, 14, 6, 5, 8, 15, 3, 9, 7, 4, 11, 13, and 2, one at a time, into an initially empty binary heap. PART-B 1. Define AVL trees? Explain the LL, RR, RL, LR case with an example? 2. Discuss various rotations of AVL tree in brief. 3. Discuss single rotation with its routine in brief. 4. Explain double rotation with its routine in detail. 5. Show the result of inserting the following words into the AVL tree: Madhushri, Kanchan, Anagha, Rohit, Neeta, Snehal, Pratibha, Lalitha, Mrudul, Kavitha, Apurva, Harsha.

29 6. Define priority queue? Explain the basic heap operation with an example? 7. Explain any two techniques to overcome hash collision? Separate chaining (open hash) a. Example b. Explanation c. Coding Open addressing (close addressing) Linear probing Quadratic probing Double hashing 8. What are the various methods involved to solve hashing function? 9. Discuss binary heap or priority queue in brief. 10. Write and test a program that performs the operations insert, delete_min, build_heap, find_min, decrease_key, delete, and increase_key in a binary heap. 11. Write note on B-tree or (2-3-4 tree, 2-3 tree) 12. Given input {4371, 1323, 6173, 4199, 4344, 9679, 1989} and a hash function h(x) = x (mod 10), show the resulting a. open hash table b. closed hash table using linear probing c. closed hash table using quadratic probing d. closed hash table with second hash function h2(x) = 7 - (x mod 7)

30 UNIT-IV (GRAPHS) 110. Define Graph? A graph G consist of a nonempty set V which is a set of nodes of the graph, a set E which is the set of edges of the graph, and a mapping from the set for edge E to a set of pairs of elements of V. It can also be represented as G=(V, E) Define adjacent nodes? Any two nodes which are connected by an edge in a graph are called adjacent nodes. For example, if and edge xîe is associated with a pair of nodes (u,v) where u, v Î V, then we say that the edge x connects the nodes u and v What is a directed graph? A graph in which every edge is directed is called a directed graph What is a undirected graph? A graph in which every edge is undirected is called a directed graph What is a loop? An edge of a graph which connects to itself is called a loop or sling What is a simple graph? A simple graph is a graph, which has not more than one edge between a pair of nodes than such a graph is called a simple graph What is a weighted graph? A graph in which weights are assigned to every edge is called a weighted graph Define out degree of a graph? In a directed graph, for any node v, the number of edges which have v as their initial node is called the out degree of the node v Define indegree of a graph? In a directed graph, for any node v, the number of edges which have v as their terminal node is called the indegree of the node v Define path in a graph? The path in a graph is the route taken to reach terminal node from a starting node.

31 120. What is a simple path? A path in a diagram in which the edges are distinct is called a simple path. It is also called as edge simple What is a cycle or a circuit? A path which originates and ends in the same node is called a cycle or circuit What is an acyclic graph? A simple diagram which does not have any cycles is called an acyclic graph What is meant by strongly connected in a graph? An undirected graph is connected, if there is a path from every vertex to every other vertex. A directed graph with this property is called strongly connected When is a graph said to be weakly connected? When a directed graph is not strongly connected but the underlying graph is connected, then the graph is said to be weakly connected Name the different ways of representing a graph? a. Adjacency matrix b. Adjacency list 126. What is an undirected acyclic graph? When every edge in an acyclic graph is undirected, it is called an undirected acyclic graph. It is also called as undirected forest What are the two traversal strategies used in traversing a graph? a. Breadth first search b. Depth first search 128. What is a minimum spanning tree? A minimum spanning tree of an undirected graph G is a tree formed from graph edges that connects all the vertices of G at the lowest total cost What is a forest? A forest may be defined as an acyclic graph in which every node has one or no predecessors.a tree may be defined as a forest in which only a single node called root has no predecessors.

32 130. Define articulation points. If a graph is not biconnected,the vertices whose removal would disconnect the graph are known as articulation points Explain about Adjacency Matrix Adjacency matrix consists of a n*n matrix where n is the no. of vertices present In the graph,which consists of values either 0 or Explain about Adjacency linked list. It consists of a table with the no. of entries for each vertex for each entry a linked List is inititated for the vertices adjacent to the corresponding table entry What is a single souce shortest path problem? Given as an input,a weighted graph,g= and a distinguished vertex S as the source vertex.single source shortest path problem finds the shortest weighted path from s to every other vertex in G Explain about Unweighted shortest path. Single source shortest path finds the shortest path from the source to each and every vertex present in a unweighted graph.here no cost is associated with the edges connecting the vertices.always unit cost is associated with each edge Explain about Weighted shortest path Single source shortest path finds the shortest path from the source to each and Every vertex present In a weighted graph.in a weighted graph some cost is always Associated with the edges connecting the vertices What are the methods to solve minimum spanning tree? a) Prim s algorithm b) Kruskal s algorithm 137. Explain briefly about Prim s algorithm Prim s algorithm creates the spanning tree in various stages.at each stage,a node is picked as the root and an edge is added and thus the associated vertex along with it Define a depth first spanning tree. The tree that is formulated by depth first search on a graph is called as depth first spanning tree. The depth first spanning tree consists of tree edges and back edges What is a tree edge? Traversal from one vertex to the next vertex in a graph is called as a tree edge.

33 140. What is a back edge? The possibility of reaching an already marked vertex is indicated by a dashed line, in a graph is called as back edge 141. What are the conditions for a graph to become a tree? A graph is a tree if it has two properties. i. If it is a connected graph. ii. There should not be any cycles in the graph Define Acyclic graph. A graph with no cycles is called Acyclic graph.a directed graph with no Edges is called as a directed Acyclic graph (or) DAG.DAGS are used for compiler Optimization process A graph G = (V, E) consists of a set of vertices, V, and a set of edges, E. Each edge is a pair (v,w), where v,w V. Edges are sometimes referred to as arcs If the pair is ordered, then the graph is directed. Directed graphs are sometimes referred to as digraphs In an undirected graph with edge (v,w), and hence (w,v), w is adjacent to v and v is adjacent to w. Sometimes an edge has a third component, known as either a weight or a cost A cycle in a directed graph is a path of length at least 1 such that w1 = wn; this cycle is simple if the path is simple An undirected graph is connected if there is a path from every vertex to every other vertex. A directed graph with this property is called strongly connected 148. If a directed graph is not strongly connected, but the underlying graph (without direction to the arcs) is connected, then the graph is said to be weakly connected A complete graph is a graph in which there is an edge between every pair of vertices A topological sort is an ordering of vertices in a directed acyclic graph, such that if there is a path from vi to vj, then vj appears after vi in the ordering.

34 151. SINGLE-SOURCE SHORTEST-PATH PROBLEM: Given as input a weighted graph, G = (V, E), and a distinguished vertex, s, find the shortest weighted path from s to every other vertex in G Prim's Algorithm One way to compute a minimum spanning tree is to grow the tree in successive stages. In each stage, one node is picked as the root, and we add an edge, and thus an associated vertex, to the tree Kruskal's Algorithm A second greedy strategy is continually to select the edges in order of smallest weight and accept an edge if it does not cause a cycle Applications of Depth-First Search Undirected Graphs Biconnectivity Euler Circuits Directed Graphs 155. Biconnectivity: A connected undirected graph is biconnected if there are no vertices whose removal disconnects the rest of the graph. PART-B 1. Explain the various representation of graph with example in detail? Adjacency matrix Figure Explanation Table Adjacency list Figure Explanation Table 2. Define topological sort? Explain with an example? Definition Explanation Example Table Coding

35 3. Explain Dijkstra's algorithm with an example? Explanation Example Graph Table Coding 4. Explain any one shortest path algorithms in detail Dijkstra's algorithm All pair shortest path algorithm 5. Explain Depth first and breadth first traversal. 6. Discuss minimum spanning tree in brief. 7. Explain Prim's algorithm with an example? Explanation Example Graph Table Coding 8. Explain Krushal's algorithm with an example? Explanation Example Graph Table Coding 9. Find a topological ordering for the graph in Figure -a Figure a

36 10. Find the shortest path from A to all other vertices for the graph in Figure Find the shortest unweighed path from B to all other vertices for the graph in Figure Figure Find a minimum spanning tree for the graph in Figure 9.82 using both Prim's and Kruskal's algorithms. Is this minimum spanning tree unique? Why? Figure Find all the articulation points in the graph in Figure Show the depth-first spanning tree and the values of num and low for each vertex. Figure 9.83

37 13. Discuss the application of depth first search in brief. Directed graph Biconnectivity Euler Circuits

38 UNIT-V PART-A 1. Greedy algorithm A greedy algorithm is any algorithm that follows the problem solving metaheuristic of making the locally optimal choice at each stage [1] with the hope of finding the global optimum. 2. Divide and Conquer Divide: Smaller problems are solved recursively (except, of course, base cases). Conquer: The solution to the original problem is then formed from the solutions to the subproblems. 3. Greedy Algorithm: Example: 1. Dijkstra s algorithm 2. Prim s Algorithm 3. Kruskal s Algorithm 4. Divide and Conquer algorithms Divide and Conquer algorithms break the problem into several subproblems that are similar to the original problem but smaller in size, solve the subproblems recursively, and then combine these solutions to create a solution to the original problem. 5. Divide and Conquer Example: Merge Sort algorithm, Quick sort 6. Traveling Salesperson Problem: Traveling salesperson problem is to find the shortest path in directed graph that starts at a given vertex, visits each vertex in the graph exactly once. Such a path is called an optimal tour. 7. BRANCH AND BOUND A B&B algorithm searches the complete space of solutions for a given problem for the best solution. Example: O/I Knapsack problem Traveling salesman problem

39 8. Define NP. NP stands for Non-deterministic Polynomial time. This means that the problem can be solved in Polynomial time using a Non-deterministic Turing machine. 9. What is P? P is the set of all decision problems which can be solved in polynomial time by a deterministic Turing machine. Since it can solve in polynomial time, it can also be verified in polynomial time. Therefore P is a subset of NP. 10. What is NP-Complete? A problem x that is in NP is also in NP-Complete if and only if every other problem in NP can be quickly (I e. in polynomial time) transformed into x. In other words: 1. x is in NP, and 2. Every problem in NP is reducible to x 11. Dynamic programming Dynamic programming is a method for efficiently solving a broad range of search and optimization problems which exhibit the characteristics of overlapping sub problems and optimal substructure. Example: All pairs shortest path, Optimal binary search tree 1. Explain greedy algorithm in detail. 1. Dijkstra s algorithm 2. Prim s Algorithm 3. Kruskal s Algorithm PART-B 2. Discuss divide and conquer algorithm in brief. Example: Merge Sort algorithm, Quick sort 3. Explain Dynamic programming in detail. All pairs shortest path, Optimal binary search tree 4. Write note on the following: a) Backtracking b) Branch and bound (hints: traveling salesman problem) c) Randomized algorithms d) NP-complete problems (hints: shortest path algorithms, traveling salesman problem)

DATA STRUCTURES AND ALGORITHMS

DATA STRUCTURES AND ALGORITHMS DATA STRUCTURES AND ALGORITHMS UNIT 1 - LINEAR DATASTRUCTURES 1. Write down the definition of data structures? A data structure is a mathematical or logical way of organizing data in the memory that consider

More information

CS DATA STRUCTURES AND ALGORITHMS

CS DATA STRUCTURES AND ALGORITHMS Computer Science and Engineering Third Semester CS1211 - DATA STRUCTURES AND ALGORITHMS UNIT-I - INTRODUCTION TO DATASTRUCTURES 1.Write down the definition of data structures? PART -A A data structure

More information

E.G.S. PILLAY ENGINEERING COLLEGE (An Autonomous Institution, Affiliated to Anna University, Chennai) Nagore Post, Nagapattinam , Tamilnadu.

E.G.S. PILLAY ENGINEERING COLLEGE (An Autonomous Institution, Affiliated to Anna University, Chennai) Nagore Post, Nagapattinam , Tamilnadu. 17CA 104DATA STRUCTURES Academic Year : 018-019 Programme : MCA Year / Semester : I / I Question Bank Course Coordinator: Mrs. C.Mallika Course Objectives The student should be able to 1. To understand

More information

CS8391-DATA STRUCTURES QUESTION BANK UNIT I

CS8391-DATA STRUCTURES QUESTION BANK UNIT I CS8391-DATA STRUCTURES QUESTION BANK UNIT I 2MARKS 1.Define data structure. The data structure can be defined as the collection of elements and all the possible operations which are required for those

More information

CS 8391 DATA STRUCTURES

CS 8391 DATA STRUCTURES DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK CS 8391 DATA STRUCTURES UNIT- I PART A 1. Define: data structure. A data structure is a way of storing and organizing data in the memory for

More information

CS8391-DATA STRUCTURES

CS8391-DATA STRUCTURES ST.JOSEPH COLLEGE OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERI NG CS8391-DATA STRUCTURES QUESTION BANK UNIT I 2MARKS 1.Explain the term data structure. The data structure can be defined

More information

R13. II B. Tech I Semester Supplementary Examinations, May/June DATA STRUCTURES (Com. to ECE, CSE, EIE, IT, ECC)

R13. II B. Tech I Semester Supplementary Examinations, May/June DATA STRUCTURES (Com. to ECE, CSE, EIE, IT, ECC) SET - 1 II B. Tech I Semester Supplementary Examinations, May/June - 2016 PART A 1. a) Write a procedure for the Tower of Hanoi problem? b) What you mean by enqueue and dequeue operations in a queue? c)

More information

UNIT III BALANCED SEARCH TREES AND INDEXING

UNIT III BALANCED SEARCH TREES AND INDEXING UNIT III BALANCED SEARCH TREES AND INDEXING OBJECTIVE The implementation of hash tables is frequently called hashing. Hashing is a technique used for performing insertions, deletions and finds in constant

More information

DATA STRUCTURE UNIT I

DATA STRUCTURE UNIT I DATA STRUCTURE UNIT I 1. What is Data Structure? A data structure is a mathematical or logical way of organizing data in the memory that consider not only the items stored but also the relationship to

More information

R10 SET - 1. Code No: R II B. Tech I Semester, Supplementary Examinations, May

R10 SET - 1. Code No: R II B. Tech I Semester, Supplementary Examinations, May www.jwjobs.net R10 SET - 1 II B. Tech I Semester, Supplementary Examinations, May - 2012 (Com. to CSE, IT, ECC ) Time: 3 hours Max Marks: 75 *******-****** 1. a) Which of the given options provides the

More information

CS301 - Data Structures Glossary By

CS301 - Data Structures Glossary By CS301 - Data Structures Glossary By Abstract Data Type : A set of data values and associated operations that are precisely specified independent of any particular implementation. Also known as ADT Algorithm

More information

VALLIAMMAI ENGINEERING COLLEGE

VALLIAMMAI ENGINEERING COLLEGE VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 603 203 DEPARTMENT OF INFORMATION TECHNOLOGY QUESTION BANK III SEMESTER CS8391-Data Structures Regulation 2017 Academic Year 2018 19(odd Semester)

More information

DATA STRUCUTRES. A data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.

DATA STRUCUTRES. A data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently. DATA STRUCUTRES A data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently. An algorithm, which is a finite sequence of instructions, each of which

More information

INSTITUTE OF AERONAUTICAL ENGINEERING

INSTITUTE OF AERONAUTICAL ENGINEERING INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad - 500 043 COMPUTER SCIENCE AND ENGINEERING TUTORIAL QUESTION BANK Course Name Course Code Class Branch DATA STRUCTURES ACS002 B. Tech

More information

ROOT: A node which doesn't have a parent. In the above tree. The Root is A.

ROOT: A node which doesn't have a parent. In the above tree. The Root is A. TREE: A tree is a finite set of one or more nodes such that there is a specially designated node called the Root, and zero or more non empty sub trees T 1, T 2...T k, each of whose roots are connected

More information

Department of Computer Science and Technology

Department of Computer Science and Technology UNIT : Stack & Queue Short Questions 1 1 1 1 1 1 1 1 20) 2 What is the difference between Data and Information? Define Data, Information, and Data Structure. List the primitive data structure. List the

More information

Table of Contents. Chapter 1: Introduction to Data Structures... 1

Table of Contents. Chapter 1: Introduction to Data Structures... 1 Table of Contents Chapter 1: Introduction to Data Structures... 1 1.1 Data Types in C++... 2 Integer Types... 2 Character Types... 3 Floating-point Types... 3 Variables Names... 4 1.2 Arrays... 4 Extraction

More information

End-Term Examination Second Semester [MCA] MAY-JUNE 2006

End-Term Examination Second Semester [MCA] MAY-JUNE 2006 (Please write your Roll No. immediately) Roll No. Paper Code: MCA-102 End-Term Examination Second Semester [MCA] MAY-JUNE 2006 Subject: Data Structure Time: 3 Hours Maximum Marks: 60 Note: Question 1.

More information

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING B.E SECOND SEMESTER CS 6202 PROGRAMMING AND DATA STRUCTURES I TWO MARKS UNIT I- 2 MARKS

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING B.E SECOND SEMESTER CS 6202 PROGRAMMING AND DATA STRUCTURES I TWO MARKS UNIT I- 2 MARKS DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING B.E SECOND SEMESTER CS 6202 PROGRAMMING AND DATA STRUCTURES I TWO MARKS UNIT I- 2 MARKS 1. Define global declaration? The variables that are used in more

More information

Fundamentals of Data Structure

Fundamentals of Data Structure Fundamentals of Data Structure Set-1 1. Which if the following is/are the levels of implementation of data structure A) Abstract level B) Application level C) Implementation level D) All of the above 2.

More information

Data Structures. 1. Each entry in a linked list is a called a (a)link (b)node (c)data structure (d)none of the above

Data Structures. 1. Each entry in a linked list is a called a (a)link (b)node (c)data structure (d)none of the above Data Structures 1. Each entry in a linked list is a called a --------- (a)link (b)node (c)data structure (d)none of the above 2. Linked list uses type of memory allocation (a)static (b)dynamic (c)random

More information

DATA STRUCTURE : A MCQ QUESTION SET Code : RBMCQ0305

DATA STRUCTURE : A MCQ QUESTION SET Code : RBMCQ0305 Q.1 If h is any hashing function and is used to hash n keys in to a table of size m, where n

More information

VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur

VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 60 0 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK III SEMESTER CS89- DATA STRUCTURES Regulation 07 Academic Year 08 9 Prepared by

More information

EC8393FUNDAMENTALS OF DATA STRUCTURES IN C Unit 3

EC8393FUNDAMENTALS OF DATA STRUCTURES IN C Unit 3 UNIT 3 LINEAR DATA STRUCTURES 1. Define Data Structures Data Structures is defined as the way of organizing all data items that consider not only the elements stored but also stores the relationship between

More information

12 Abstract Data Types

12 Abstract Data Types 12 Abstract Data Types 12.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: Define the concept of an abstract data type (ADT). Define

More information

Course Review for Finals. Cpt S 223 Fall 2008

Course Review for Finals. Cpt S 223 Fall 2008 Course Review for Finals Cpt S 223 Fall 2008 1 Course Overview Introduction to advanced data structures Algorithmic asymptotic analysis Programming data structures Program design based on performance i.e.,

More information

Data Structure. IBPS SO (IT- Officer) Exam 2017

Data Structure. IBPS SO (IT- Officer) Exam 2017 Data Structure IBPS SO (IT- Officer) Exam 2017 Data Structure: In computer science, a data structure is a way of storing and organizing data in a computer s memory so that it can be used efficiently. Data

More information

ASSIGNMENTS. Progra m Outcom e. Chapter Q. No. Outcom e (CO) I 1 If f(n) = Θ(g(n)) and g(n)= Θ(h(n)), then proof that h(n) = Θ(f(n))

ASSIGNMENTS. Progra m Outcom e. Chapter Q. No. Outcom e (CO) I 1 If f(n) = Θ(g(n)) and g(n)= Θ(h(n)), then proof that h(n) = Θ(f(n)) ASSIGNMENTS Chapter Q. No. Questions Course Outcom e (CO) Progra m Outcom e I 1 If f(n) = Θ(g(n)) and g(n)= Θ(h(n)), then proof that h(n) = Θ(f(n)) 2 3. What is the time complexity of the algorithm? 4

More information

Chapter 9 Graph Algorithms

Chapter 9 Graph Algorithms Chapter 9 Graph Algorithms 2 Introduction graph theory useful in practice represent many real-life problems can be slow if not careful with data structures 3 Definitions an undirected graph G = (V, E)

More information

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions Introduction Chapter 9 Graph Algorithms graph theory useful in practice represent many real-life problems can be slow if not careful with data structures 2 Definitions an undirected graph G = (V, E) is

More information

SNS COLLEGE OF TECHNOLOGY

SNS COLLEGE OF TECHNOLOGY SNS COLLEGE OF TECHNOLOGY COIMBATORE 5 DEPARTMENT OF COMPUTER SIENCE AND ENGINEERING (UG & PG) Second Year Computer Science and Engineering, rd Semester 2 Marks Question and Answer Subject Code & Name:

More information

GUJARAT TECHNOLOGICAL UNIVERSITY COMPUTER ENGINEERING (07) / INFORMATION TECHNOLOGY (16) / INFORMATION & COMMUNICATION TECHNOLOGY (32) DATA STRUCTURES

GUJARAT TECHNOLOGICAL UNIVERSITY COMPUTER ENGINEERING (07) / INFORMATION TECHNOLOGY (16) / INFORMATION & COMMUNICATION TECHNOLOGY (32) DATA STRUCTURES GUJARAT TECHNOLOGICAL UNIVERSITY COMPUTER ENGINEERING () / INFMATION TECHNOLOGY (6) / INFMATION & COMMUNICATION TECHNOLOGY (32) DATA STRUCTURES Type of course: Compulsory SUBJECT CODE: 2302 B.E. 3 rd Semester

More information

FINALTERM EXAMINATION Fall 2009 CS301- Data Structures Question No: 1 ( Marks: 1 ) - Please choose one The data of the problem is of 2GB and the hard

FINALTERM EXAMINATION Fall 2009 CS301- Data Structures Question No: 1 ( Marks: 1 ) - Please choose one The data of the problem is of 2GB and the hard FINALTERM EXAMINATION Fall 2009 CS301- Data Structures Question No: 1 The data of the problem is of 2GB and the hard disk is of 1GB capacity, to solve this problem we should Use better data structures

More information

8. Write an example for expression tree. [A/M 10] (A+B)*((C-D)/(E^F))

8. Write an example for expression tree. [A/M 10] (A+B)*((C-D)/(E^F)) DHANALAKSHMI COLLEGE OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING EC6301 OBJECT ORIENTED PROGRAMMING AND DATA STRUCTURES UNIT IV NONLINEAR DATA STRUCTURES Part A 1. Define Tree [N/D 08]

More information

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE A6-R3: DATA STRUCTURE THROUGH C LANGUAGE NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be answered in the TEAR-OFF

More information

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE A6-R3: DATA STRUCTURE THROUGH C LANGUAGE NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be answered in the TEAR-OFF

More information

Prepared By: Ms. Nidhi Solanki (Assist. Prof.) Page 1

Prepared By: Ms. Nidhi Solanki (Assist. Prof.) Page 1 QUESTION BANK ON COURSE: 304: PRELIMINARIES: 1. What is array of pointer, explain with appropriate example? 2 2. Differentiate between call by value and call by reference, give example. 3. Explain pointer

More information

Trees. A tree is a directed graph with the property

Trees. A tree is a directed graph with the property 2: Trees Trees A tree is a directed graph with the property There is one node (the root) from which all other nodes can be reached by exactly one path. Seen lots of examples. Parse Trees Decision Trees

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) WINTER 18 EXAMINATION Subject Name: Data Structure Model wer Subject Code: 17330 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in

More information

Tree: non-recursive definition. Trees, Binary Search Trees, and Heaps. Tree: recursive definition. Tree: example.

Tree: non-recursive definition. Trees, Binary Search Trees, and Heaps. Tree: recursive definition. Tree: example. Trees, Binary Search Trees, and Heaps CS 5301 Fall 2013 Jill Seaman Tree: non-recursive definition Tree: set of nodes and directed edges - root: one node is distinguished as the root - Every node (except

More information

MID TERM MEGA FILE SOLVED BY VU HELPER Which one of the following statement is NOT correct.

MID TERM MEGA FILE SOLVED BY VU HELPER Which one of the following statement is NOT correct. MID TERM MEGA FILE SOLVED BY VU HELPER Which one of the following statement is NOT correct. In linked list the elements are necessarily to be contiguous In linked list the elements may locate at far positions

More information

Binary Trees, Binary Search Trees

Binary Trees, Binary Search Trees Binary Trees, Binary Search Trees Trees Linear access time of linked lists is prohibitive Does there exist any simple data structure for which the running time of most operations (search, insert, delete)

More information

Chapter 9 Graph Algorithms

Chapter 9 Graph Algorithms Chapter 9 Graph Algorithms 2 Introduction graph theory useful in practice represent many real-life problems can be if not careful with data structures 3 Definitions an undirected graph G = (V, E) is a

More information

COMP : Trees. COMP20012 Trees 219

COMP : Trees. COMP20012 Trees 219 COMP20012 3: Trees COMP20012 Trees 219 Trees Seen lots of examples. Parse Trees Decision Trees Search Trees Family Trees Hierarchical Structures Management Directories COMP20012 Trees 220 Trees have natural

More information

Data Structures Question Bank Multiple Choice

Data Structures Question Bank Multiple Choice Section 1. Fundamentals: Complexity, Algorthm Analysis 1. An algorithm solves A single problem or function Multiple problems or functions Has a single programming language implementation 2. A solution

More information

R10 SET - 1. Code No: R II B. Tech I Semester, Supplementary Examinations, May

R10 SET - 1. Code No: R II B. Tech I Semester, Supplementary Examinations, May Code No: R21051 R10 SET - 1 II B. Tech I Semester, Supplementary Examinations, May - 2012 DATA STRUCTURES (Com. to CSE, IT, ECC ) Time: 3 hours Max Marks: 75 Answer any FIVE Questions All Questions carry

More information

Course Review. Cpt S 223 Fall 2010

Course Review. Cpt S 223 Fall 2010 Course Review Cpt S 223 Fall 2010 1 Final Exam When: Thursday (12/16) 8-10am Where: in class Closed book, closed notes Comprehensive Material for preparation: Lecture slides & class notes Homeworks & program

More information

DYNAMIC MEMORY ALLOCATION AND DEALLOCATION

DYNAMIC MEMORY ALLOCATION AND DEALLOCATION COURSE TITLE DATA STRUCTURE DETAILED SYLLABUS SR.NO NAME OF CHAPTERS & DETAILS HOURS ALLOTTED 1 USER DEFINED DATATYPE /STRUCTURE About structure Defining structure Accessing structure element Array of

More information

Objective Questions for Online Practical Exams under CBCS Scheme Subject: Data Structure-I (CS-113)

Objective Questions for Online Practical Exams under CBCS Scheme Subject: Data Structure-I (CS-113) Objective Questions for Online Practical Exams under CBCS Scheme Subject: Data Structure-I (CS-113) 1. The number of interchanges required to sort 5, 1, 6, 2 4 in ascending order using Bubble Sort (A)

More information

Bachelor Level/ First Year/ Second Semester/ Science Full Marks: 60 Computer Science and Information Technology (CSc. 154) Pass Marks: 24

Bachelor Level/ First Year/ Second Semester/ Science Full Marks: 60 Computer Science and Information Technology (CSc. 154) Pass Marks: 24 Prepared By ASCOL CSIT 2070 Batch Institute of Science and Technology 2065 Bachelor Level/ First Year/ Second Semester/ Science Full Marks: 60 Computer Science and Information Technology (CSc. 154) Pass

More information

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Introduction and Overview

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Introduction and Overview Computer Science 385 Analysis of Algorithms Siena College Spring 2011 Topic Notes: Introduction and Overview Welcome to Analysis of Algorithms! What is an Algorithm? A possible definition: a step-by-step

More information

Chapter 9 Graph Algorithms

Chapter 9 Graph Algorithms Introduction graph theory useful in practice represent many real-life problems can be if not careful with data structures Chapter 9 Graph s 2 Definitions Definitions an undirected graph is a finite set

More information

Introduction p. 1 Pseudocode p. 2 Algorithm Header p. 2 Purpose, Conditions, and Return p. 3 Statement Numbers p. 4 Variables p. 4 Algorithm Analysis

Introduction p. 1 Pseudocode p. 2 Algorithm Header p. 2 Purpose, Conditions, and Return p. 3 Statement Numbers p. 4 Variables p. 4 Algorithm Analysis Introduction p. 1 Pseudocode p. 2 Algorithm Header p. 2 Purpose, Conditions, and Return p. 3 Statement Numbers p. 4 Variables p. 4 Algorithm Analysis p. 5 Statement Constructs p. 5 Pseudocode Example p.

More information

Trees. (Trees) Data Structures and Programming Spring / 28

Trees. (Trees) Data Structures and Programming Spring / 28 Trees (Trees) Data Structures and Programming Spring 2018 1 / 28 Trees A tree is a collection of nodes, which can be empty (recursive definition) If not empty, a tree consists of a distinguished node r

More information

QUESTION BANK. Prepared by,mrs.d.maladhy AP/IT,RGCET. Page 1

QUESTION BANK. Prepared by,mrs.d.maladhy AP/IT,RGCET. Page 1 UNIT I 1.Write statements to declare integer Pointer and Float Pointer. Also write the statement to convert float pointer.(apr/may 2016) 2. What is a Stack? Mention the order followed to add or delete

More information

UCS-406 (Data Structure) Lab Assignment-1 (2 weeks)

UCS-406 (Data Structure) Lab Assignment-1 (2 weeks) UCS-40 (Data Structure) Lab Assignment- (2 weeks) Implement the following programs in C/C++/Python/Java using functions a) Insertion Sort b) Bubble Sort c) Selection Sort d) Linear Search e) Binary Search

More information

COSC 2007 Data Structures II Final Exam. Part 1: multiple choice (1 mark each, total 30 marks, circle the correct answer)

COSC 2007 Data Structures II Final Exam. Part 1: multiple choice (1 mark each, total 30 marks, circle the correct answer) COSC 2007 Data Structures II Final Exam Thursday, April 13 th, 2006 This is a closed book and closed notes exam. There are total 3 parts. Please answer the questions in the provided space and use back

More information

3. Priority Queues. ADT Stack : LIFO. ADT Queue : FIFO. ADT Priority Queue : pick the element with the lowest (or highest) priority.

3. Priority Queues. ADT Stack : LIFO. ADT Queue : FIFO. ADT Priority Queue : pick the element with the lowest (or highest) priority. 3. Priority Queues 3. Priority Queues ADT Stack : LIFO. ADT Queue : FIFO. ADT Priority Queue : pick the element with the lowest (or highest) priority. Malek Mouhoub, CS340 Winter 2007 1 3. Priority Queues

More information

Question Bank Subject: Advanced Data Structures Class: SE Computer

Question Bank Subject: Advanced Data Structures Class: SE Computer Question Bank Subject: Advanced Data Structures Class: SE Computer Question1: Write a non recursive pseudo code for post order traversal of binary tree Answer: Pseudo Code: 1. Push root into Stack_One.

More information

UNIT 5 GRAPH. Application of Graph Structure in real world:- Graph Terminologies:

UNIT 5 GRAPH. Application of Graph Structure in real world:- Graph Terminologies: UNIT 5 CSE 103 - Unit V- Graph GRAPH Graph is another important non-linear data structure. In tree Structure, there is a hierarchical relationship between, parent and children that is one-to-many relationship.

More information

PROGRAMMING IN C++ (Regulation 2008) Answer ALL questions PART A (10 2 = 20 Marks) PART B (5 16 = 80 Marks) function? (8)

PROGRAMMING IN C++ (Regulation 2008) Answer ALL questions PART A (10 2 = 20 Marks) PART B (5 16 = 80 Marks) function? (8) B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2009 EC 2202 DATA STRUCTURES AND OBJECT ORIENTED Time: Three hours PROGRAMMING IN C++ Answer ALL questions Maximum: 100 Marks 1. When do we declare a

More information

UNIT IV -NON-LINEAR DATA STRUCTURES 4.1 Trees TREE: A tree is a finite set of one or more nodes such that there is a specially designated node called the Root, and zero or more non empty sub trees T1,

More information

CSE373: Data Structures & Algorithms Lecture 28: Final review and class wrap-up. Nicki Dell Spring 2014

CSE373: Data Structures & Algorithms Lecture 28: Final review and class wrap-up. Nicki Dell Spring 2014 CSE373: Data Structures & Algorithms Lecture 28: Final review and class wrap-up Nicki Dell Spring 2014 Final Exam As also indicated on the web page: Next Tuesday, 2:30-4:20 in this room Cumulative but

More information

Cpt S 223 Fall Cpt S 223. School of EECS, WSU

Cpt S 223 Fall Cpt S 223. School of EECS, WSU Course Review Cpt S 223 Fall 2012 1 Final Exam When: Monday (December 10) 8 10 AM Where: in class (Sloan 150) Closed book, closed notes Comprehensive Material for preparation: Lecture slides & class notes

More information

a) State the need of data structure. Write the operations performed using data structures.

a) State the need of data structure. Write the operations performed using data structures. Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate

More information

CSCI2100B Data Structures Trees

CSCI2100B Data Structures Trees CSCI2100B Data Structures Trees Irwin King king@cse.cuhk.edu.hk http://www.cse.cuhk.edu.hk/~king Department of Computer Science & Engineering The Chinese University of Hong Kong Introduction General Tree

More information

( ) ( ) C. " 1 n. ( ) $ f n. ( ) B. " log( n! ) ( ) and that you already know ( ) ( ) " % g( n) ( ) " #&

( ) ( ) C.  1 n. ( ) $ f n. ( ) B.  log( n! ) ( ) and that you already know ( ) ( )  % g( n) ( )  #& CSE 0 Name Test Summer 008 Last 4 Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time for the following code is in which set? for (i=0; i

More information

Course Name: B.Tech. 3 th Sem. No of hours allotted to complete the syllabi: 44 Hours No of hours allotted per week: 3 Hours. Planned.

Course Name: B.Tech. 3 th Sem. No of hours allotted to complete the syllabi: 44 Hours No of hours allotted per week: 3 Hours. Planned. Course Name: B.Tech. 3 th Sem. Subject: Data Structures No of hours allotted to complete the syllabi: 44 Hours No of hours allotted per week: 3 Hours Paper Code: ETCS-209 Topic Details No of Hours Planned

More information

Course Review. Cpt S 223 Fall 2009

Course Review. Cpt S 223 Fall 2009 Course Review Cpt S 223 Fall 2009 1 Final Exam When: Tuesday (12/15) 8-10am Where: in class Closed book, closed notes Comprehensive Material for preparation: Lecture slides & class notes Homeworks & program

More information

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR STUDENT IDENTIFICATION NO MULTIMEDIA COLLEGE JALAN GURNEY KIRI 54100 KUALA LUMPUR FIFTH SEMESTER FINAL EXAMINATION, 2014/2015 SESSION PSD2023 ALGORITHM & DATA STRUCTURE DSEW-E-F-2/13 25 MAY 2015 9.00 AM

More information

CSCI2100B Data Structures Heaps

CSCI2100B Data Structures Heaps CSCI2100B Data Structures Heaps Irwin King king@cse.cuhk.edu.hk http://www.cse.cuhk.edu.hk/~king Department of Computer Science & Engineering The Chinese University of Hong Kong Introduction In some applications,

More information

Lec 17 April 8. Topics: binary Trees expression trees. (Chapter 5 of text)

Lec 17 April 8. Topics: binary Trees expression trees. (Chapter 5 of text) Lec 17 April 8 Topics: binary Trees expression trees Binary Search Trees (Chapter 5 of text) Trees Linear access time of linked lists is prohibitive Heap can t support search in O(log N) time. (takes O(N)

More information

TREES. Trees - Introduction

TREES. Trees - Introduction TREES Chapter 6 Trees - Introduction All previous data organizations we've studied are linear each element can have only one predecessor and successor Accessing all elements in a linear sequence is O(n)

More information

FORTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLIGY- MARCH, 2012 DATA STRUCTURE (Common to CT and IF) [Time: 3 hours

FORTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLIGY- MARCH, 2012 DATA STRUCTURE (Common to CT and IF) [Time: 3 hours TED (10)-3071 Reg. No.. (REVISION-2010) (Maximum marks: 100) Signature. FORTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLIGY- MARCH, 2012 DATA STRUCTURE (Common to CT and IF) [Time: 3 hours PART

More information

) $ f ( n) " %( g( n)

) $ f ( n)  %( g( n) CSE 0 Name Test Spring 008 Last Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to compute the sum of the n elements of an integer array is: # A.

More information

& ( D. " mnp ' ( ) n 3. n 2. ( ) C. " n

& ( D.  mnp ' ( ) n 3. n 2. ( ) C.  n CSE Name Test Summer Last Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to multiply two n " n matrices is: A. " n C. "% n B. " max( m,n, p). The

More information

FORTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLIGY- OCTOBER, 2012 DATA STRUCTURE

FORTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLIGY- OCTOBER, 2012 DATA STRUCTURE TED (10)-3071 Reg. No.. (REVISION-2010) Signature. FORTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLIGY- OCTOBER, 2012 DATA STRUCTURE (Common to CT and IF) [Time: 3 hours (Maximum marks: 100)

More information

( ). Which of ( ) ( ) " #& ( ) " # g( n) ( ) " # f ( n) Test 1

( ). Which of ( ) ( )  #& ( )  # g( n) ( )  # f ( n) Test 1 CSE 0 Name Test Summer 006 Last Digits of Student ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to multiply two n x n matrices is: A. "( n) B. "( nlogn) # C.

More information

logn D. Θ C. Θ n 2 ( ) ( ) f n B. nlogn Ο n2 n 2 D. Ο & % ( C. Θ # ( D. Θ n ( ) Ω f ( n)

logn D. Θ C. Θ n 2 ( ) ( ) f n B. nlogn Ο n2 n 2 D. Ο & % ( C. Θ # ( D. Θ n ( ) Ω f ( n) CSE 0 Test Your name as it appears on your UTA ID Card Fall 0 Multiple Choice:. Write the letter of your answer on the line ) to the LEFT of each problem.. CIRCLED ANSWERS DO NOT COUNT.. points each. The

More information

Topics. Trees Vojislav Kecman. Which graphs are trees? Terminology. Terminology Trees as Models Some Tree Theorems Applications of Trees CMSC 302

Topics. Trees Vojislav Kecman. Which graphs are trees? Terminology. Terminology Trees as Models Some Tree Theorems Applications of Trees CMSC 302 Topics VCU, Department of Computer Science CMSC 302 Trees Vojislav Kecman Terminology Trees as Models Some Tree Theorems Applications of Trees Binary Search Tree Decision Tree Tree Traversal Spanning Trees

More information

Second Semester - Question Bank Department of Computer Science Advanced Data Structures and Algorithms...

Second Semester - Question Bank Department of Computer Science Advanced Data Structures and Algorithms... Second Semester - Question Bank Department of Computer Science Advanced Data Structures and Algorithms.... Q1) Let the keys are 28, 47, 20, 36, 43, 23, 25, 54 and table size is 11 then H(28)=28%11=6; H(47)=47%11=3;

More information

DATA STRUCTURES AND ALGORITHMS

DATA STRUCTURES AND ALGORITHMS DATA STRUCTURES AND ALGORITHMS For COMPUTER SCIENCE DATA STRUCTURES &. ALGORITHMS SYLLABUS Programming and Data Structures: Programming in C. Recursion. Arrays, stacks, queues, linked lists, trees, binary

More information

D. Θ nlogn ( ) D. Ο. ). Which of the following is not necessarily true? . Which of the following cannot be shown as an improvement? D.

D. Θ nlogn ( ) D. Ο. ). Which of the following is not necessarily true? . Which of the following cannot be shown as an improvement? D. CSE 0 Name Test Fall 00 Last Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to convert an array, with priorities stored at subscripts through n,

More information

1. Attempt any three of the following: 15

1. Attempt any three of the following: 15 (Time: 2½ hours) Total Marks: 75 N. B.: (1) All questions are compulsory. (2) Make suitable assumptions wherever necessary and state the assumptions made. (3) Answers to the same question must be written

More information

17CS33:Data Structures Using C QUESTION BANK

17CS33:Data Structures Using C QUESTION BANK 17CS33:Data Structures Using C QUESTION BANK REVIEW OF STRUCTURES AND POINTERS, INTRODUCTION TO SPECIAL FEATURES OF C Learn : Usage of structures, unions - a conventional tool for handling a group of logically

More information

Course goals. exposure to another language. knowledge of specific data structures. impact of DS design & implementation on program performance

Course goals. exposure to another language. knowledge of specific data structures. impact of DS design & implementation on program performance Course goals exposure to another language C++ Object-oriented principles knowledge of specific data structures lists, stacks & queues, priority queues, dynamic dictionaries, graphs impact of DS design

More information

Answers. 1. (A) Attempt any five : 20 Marks

Answers. 1. (A) Attempt any five : 20 Marks Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate

More information

DATA STRUCTURES AND ALGORITHMS UNIT I LINEAR STRUCTURES

DATA STRUCTURES AND ALGORITHMS UNIT I LINEAR STRUCTURES DATA STRUCTURES AND ALGORITHMS UNIT I LINEAR STRUCTURES Highlights of the chapter Introduce the concept of Abstract Data Types (ADTs). Show how to efficiently perform operations on lists. Introduce the

More information

7.1 Introduction. A (free) tree T is A simple graph such that for every pair of vertices v and w there is a unique path from v to w

7.1 Introduction. A (free) tree T is A simple graph such that for every pair of vertices v and w there is a unique path from v to w Chapter 7 Trees 7.1 Introduction A (free) tree T is A simple graph such that for every pair of vertices v and w there is a unique path from v to w Tree Terminology Parent Ancestor Child Descendant Siblings

More information

9. The expected time for insertion sort for n keys is in which set? (All n! input permutations are equally likely.)

9. The expected time for insertion sort for n keys is in which set? (All n! input permutations are equally likely.) CSE 0 Name Test Spring 006 Last 4 Digits of Student ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. Suppose f ( x) is a monotonically increasing function. Which of the

More information

VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK

VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur 603203. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK Degree & Branch : B.E E.C.E. Year & Semester : II / IV Section : ECE 1, 2 &

More information

Direct Addressing Hash table: Collision resolution how handle collisions Hash Functions:

Direct Addressing Hash table: Collision resolution how handle collisions Hash Functions: Direct Addressing - key is index into array => O(1) lookup Hash table: -hash function maps key to index in table -if universe of keys > # table entries then hash functions collision are guaranteed => need

More information

Algorithms and programs, basic idea of pseudo-code.algorithm efficiency and analysis, time and space analysis of algorithms order notations.

Algorithms and programs, basic idea of pseudo-code.algorithm efficiency and analysis, time and space analysis of algorithms order notations. B. P. Poddar Institute of Management & Technology Department of Information Technology Course Syllabus : Data Structure & Algorithm Academic Year:.18-19... Semester:...3rd... Module -I. [8L] Linear Data

More information

DS ata Structures Aptitude

DS ata Structures Aptitude DS ata Structures Aptitude 1. What is data structure? A data structure is a way of organizing data that considers not only the items stored, but also their relationship to each other. Advance knowledge

More information

Algorithms and Data Structures

Algorithms and Data Structures Algorithms and Data Structures Dr. Malek Mouhoub Department of Computer Science University of Regina Fall 2002 Malek Mouhoub, CS3620 Fall 2002 1 6. Priority Queues 6. Priority Queues ffl ADT Stack : LIFO.

More information

CS521 \ Notes for the Final Exam

CS521 \ Notes for the Final Exam CS521 \ Notes for final exam 1 Ariel Stolerman Asymptotic Notations: CS521 \ Notes for the Final Exam Notation Definition Limit Big-O ( ) Small-o ( ) Big- ( ) Small- ( ) Big- ( ) Notes: ( ) ( ) ( ) ( )

More information

Stacks, Queues and Hierarchical Collections. 2501ICT Logan

Stacks, Queues and Hierarchical Collections. 2501ICT Logan Stacks, Queues and Hierarchical Collections 2501ICT Logan Contents Linked Data Structures Revisited Stacks Queues Trees Binary Trees Generic Trees Implementations 2 Queues and Stacks Queues and Stacks

More information

MIDTERM EXAMINATION Spring 2010 CS301- Data Structures

MIDTERM EXAMINATION Spring 2010 CS301- Data Structures MIDTERM EXAMINATION Spring 2010 CS301- Data Structures Question No: 1 Which one of the following statement is NOT correct. In linked list the elements are necessarily to be contiguous In linked list the

More information

1 P a g e A r y a n C o l l e g e \ B S c _ I T \ C \

1 P a g e A r y a n C o l l e g e \ B S c _ I T \ C \ BSc IT C Programming (2013-2017) Unit I Q1. What do you understand by type conversion? (2013) Q2. Why we need different data types? (2013) Q3 What is the output of the following (2013) main() Printf( %d,

More information

( ) n 3. n 2 ( ) D. Ο

( ) n 3. n 2 ( ) D. Ο CSE 0 Name Test Summer 0 Last Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to multiply two n n matrices is: A. Θ( n) B. Θ( max( m,n, p) ) C.

More information