Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
SARASWATHI VELU COLLEGE OF ENGINEERING - SHOLINGHUR DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING SYLLABUS EE2204 UNIT I DATA STRUCTURES AND ALGORITHMS LINEAR STRUCTURES 3 0 0 3 9 Abstract Data Types (ADT) – List ADT – array-based implementation – linked list implementation – cursor-based linked lists – doubly-linked lists – applications of lists – Stack ADT – Queue ADT – circular queue implementation – Applications of stacks and queues UNIT II TREE STRUCTURES 9 Need for non-linear structures – Tree ADT – tree traversals – left child right sibling data structures for general trees – Binary Tree ADT – expression trees – applications of trees – binary search tree ADT UNIT III BALANCED SEARCH TREES AND INDEXING 9 AVL trees – Binary Heaps – B-Tree – Hashing – Separate chaining – open addressing – Linear probing UNIT IV GRAPHS 9 Definitions – Topological sort – breadth-first traversal - shortest-path algorithms – minimum spanning tree – Prim's and Kruskal's algorithms – Depth-first traversal – biconnectivity – euler circuits – applications of graphs UNIT V ALGORITHM DESIGN AND ANALYSIS 9 Greedy algorithms – Divide and conquer – Dynamic programming – backtracking – branch and bound – Randomized algorithms – algorithm analysis – asymptotic notations – recurrences – NP-complete problems TOTAL: 45 PERIODS TEXT BOOKS 1. M. A. Weiss, “Data Structures and Algorithm Analysis in C”, Pearson Education Asia, 2002. 2. ISRD Group, “Data Structures using C”, Tata McGraw-Hill Publishing Company Ltd., 2006. REFERENCES 1. A. V. Aho, J. E. Hopcroft, and J. D. Ullman, “Data Structures and Algorithms”, Pearson Education, 1983. 2. R. F. Gilberg, B. A. Forouzan, “Data Structures: A Pseudocode approach with C”, Second Edition, Thomson India Edition, 2005. 3. Sara Baase and A. Van Gelder, “Computer Algorithms”, Third Edition, Pearson Education, 2000. 4. T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein, "Introduction to algorithms", Second Edition, Prentice Hall of India Ltd, 2001. . DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING 6.2 SHORT QUESTIONS AND ANSWERS UNIT-I PART - A 1. Define:Abstract data type It is defined as a set of operations. It is also defined as Logical and mathematical properties of a data type. 2. Difference between array and list? Array It consists of fixed number of objects Insertion and deletion is very difficult List It consists of variable number of elements . Insertion & deletion are performed easily 3. What are the operations that can be performed in list? 1. insertion 2. deletion 3. combining 2 or more list 4. splitting a list 5. copy a list 6.sort elements 7.search the element. 4. What are the draw balks of array implementation of list? 1.list must be known in advance. 2.insertion & deletion is very slow. 5. What are the drawbacks of a linked list? 1.insertion at front is not so easy. 2.deletion at front is difficult. 6. How to overcome the drawbacks of the linked list? By introducing a sentinel node called header(or)dummy node. 7. What is the use of availability stack? It contains the list of free nodes. A node can be inserted in a list can be taken form the stack. 8. Define doubly linked list? Linked list with two pointers is defined as doubly linked list two pointers are named as forward & backward pointers forward pointers denotes the successor backward pointers denotes predecessor of the current note. 9. List the disadvantages of circular linked list ? 1.Possible to get into an infinite loop. 2nd YEAR/ 3rd SEMESTER . DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING 2.The list should hot be empty. Identifying fist / last note is important this cont be done by using header. 10. List applications of linked list? 1.creations of linked list? 2.polynomial manipulation. 3.sorting 4.tree trades 5.mulitlist organization. 11. Define stack. Stacks are known as LIFO(last in first out) it is a list with the restriction that insertions are done at the end of the list called top. 12. What are the different ways stack can be implemented? 1.Arry implementation 2.Linked list 13. Write procedure for push operation in stack? Procedure Push (s, top, x) 1.if top >N then Write („stack overflow‟) Return. 2.top top+1 3.s [top] x. 4.return 14.List the applications of stack? 1.Conversion of infix to post fix expression. 2.Evaluation post fix expression. 3.Towers of hanoi 4.Balancing symbols. 15.Defines Queue. Queues are list where insertions is done at one end called rear and deletion is done at other end called front. 16.Applications of Queue? 1.Printer attached to a system uses the concept to print the contents stored. 2.Calls to large companies are placed in a queue 3.In large universities where resources are limited student must wait in a queue to assign to a list of terminals etc. EE2204 – DATA STRUCTURES & ALGORITHMS . DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING 17.What are the restrictions in the movement of discs in towers of hanoi ? 1.only one disc may be more at a time. 2.dise may be moved from one needle to any other 3.at no time may a larger disc rest capon a smaller disc 18.What is the use of cursor implementation of a linked list? It is useful in cases where linked list concept has to be implemented without using pointers. 19.Define: data structure It is a representation of logical relationship of data between individual elements 20.What is primitive data structure ? These are basic structures and are directly operated upon by the machine instructions. 21What is Non – Primitive data structure ? Data Structure emphasize on structuring of a group of homogeneous or heterogeneous data items. 22.What is Linear data structure? A data structure which contains a linear arrangement of elements in the memory. 23.What is non linear data structure? It represents hierarchical arrangement of elements. 24.What are the types of notations to represent Arithmetic expression? INFIX NOTATION PREFIX NOTATION POSTFIX NOTATION 25.Write a routine to check whether Queue is empty? Int IsEmpty(Queue e) { If(QNext==NULL) Return(1); } 2nd YEAR/ 3rd SEMESTER . DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING PART – B 1.What are the various Linked List operations?. Explain. 2.Explain how stack is applied to evaluate an arithmetic expression? 3.Write routines to implement addition, subtraction & differentiation of two polynomials? 4.Write the recursive routine for Towers of Hanoi?. 5.Explain cursor implementation of List? 6.Write the insertion and deletion routine for doubly linked list? UNIT – II 1.Define Tree. Tree is a finite set of one or more nodes such that there is a specially designated node called root. A B C D E 2.Define the following terms: a)Root b)Sibling c)Degree d)Leaf Root:-A node which does not have a parent. Sibling:-Children of the same parents are said to be siblings. Degree: The number of subtrees of a node is called its degree. Leaf:-A node which does not have children is called leaf or terminal node. EE2204 – DATA STRUCTURES & ALGORITHMS . DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING 3.What is binary tree? It is a tree in which no node can have more than two children A C B D E 4. What is the maximum number of nodes in a binary tree? The Maximum number of nodes in a binary tree is 2i+1. 5. Compare General Tree and Binary Tree? General Tree Binary Tree General Tree has any number of children Binary tree has not more than two children 6. what is complete binary tree? A tree is said to be complete binary tree ,if all its level except possibly the last level ,have the maximum number of possible nodes, all the nodes at the last level as far left as possible. 7. What is full binary tree? A binary tree is a full binary tree ,if it contains maximum possible number of nodes in all level. 2nd YEAR/ 3rd SEMESTER . DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING 8. What is Expression Tree? It is a binary tree in which the leaf nodes are operands and the interior nodes are operators. 9.what is binary search tree? It is a binary tree in which for every node X in the tree,the values of all the keys in its left subtree are smaller than the key value in X,and the values of right sub tree are larger than the value in X. EE2204 – DATA STRUCTURES & ALGORITHMS . DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING 10. Compare Binary Tree and Binary Search Tree Binary tree Binary Search Tree A binary tree is said to be a binary tree if it has A binary search tree is a binary tree in which key almost two children values in the left tree is less than root node and key values in the right subtree is greater than root. 26 19 30 28 22 10 25 45 8 12 11.Define tree traversal? Traversing means visiting each node only once. Tree traversal is a method of visiting all the nodes in the tree exactly once. 12.Name the 3 types of tree traversals? 1.In Order traversal. 2.Pre Order traversal. 3.Post Order traversal 13.How the inorder traversal is performed? Traverse left subtree in inorder. Visit the root Traverse right subtree in inorder. 2nd YEAR/ 3rd SEMESTER . DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING 20 30 10 10,20,30 14. List the Preorder traversal steps? Visit the root. Traverse Left subtree in pre order Traverse Right Subtree in pre order 20 30 10 20,10,30 15. List the post order traversal steps? Traverse Left subtree in post order. Traverse Right subtree in post order. Visit Root. 20 10 30 10,30,20 16. Convert the following Expression into Preorder Expression? A+B*C-D/E Preorder : *+AB-C/DE EE2204 – DATA STRUCTURES & ALGORITHMS . DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING 17. How do you construct expression tree? Read one Symbol at a time from postfix expression. Check whether the symbol is operand or operator . If the symbol is operand ,create one node tree and push pointer to the stack. If it is operator pop two pointers from the stack and form a new tree with root as operator and pointer to new node is pushed on to the stack. 18. what is Left – most child ,Right sibling data structure? In this ,cell space contains three fields namely, Left most child, Label and Right Sibling. A A B C D 19. How do you represent Binary Tree? 1.Linear Representation or Array Representation. 2.Linked List Representation (Pointer) 20. Why we go for Non-Linear Data Structure? Trees are used to organize information in data base system and to represent syntactic structure of source programs in computers. It can be used to evaluate arithmetic expression. 21. Define following terms: a).Child b).Link Child:-If the immediate predecessor of a node is the parent of the node then all immediate successor of a node is known as child. Link:-This is a pointer to a node in the tree. 2nd YEAR/ 3rd SEMESTER . DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING 22. Draw the binary tree for the following expression (A+B)*(C-D) * + + B A C D 23. Draw the Array representation of the above mentioned tree? * + - A B C D EE2204 – DATA STRUCTURES & ALGORITHMS . DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING PART – B 1. A).Write an algorithm to find an element from binary search tree. B).Write a program to insert and delete an element from a binary tree? 2. What are the different tree traversal technique?Expalin 3. Explain the recursive and non recursive routine for FindMin and FindMax? 4. What is the need for nonlinear data structure? Explain Expression Tree with example? UNIT – III PART - A 1. What is AVL Tree? AVL tree –Adelson – Velskii and Landis Tree is a binary search tree with a balancing conditions. The condition is Right and Left trees have the same height. 2. What is hashing? The implementation of Hash Tables is called as Hashing. It is a technique used for performing insertions,deletions,and finds in constant average time. 3. What is Hash Table? Hash table data structure is an array of some fixed size ,containing the keys. Key is a value associated with each record. 4. What is Hashing function? It is a key – to – address transformation ,which acts upon a given key to compute the relative position of the key in the array. HASH(KEYVALUE)=KEYVALUE MOD TABLESIZE 5. List the methods of the Hashing function? 1.Module – Division 2.Mid Square Method 3.Folding Method. 4.PSEUDO Random Method 5.Digit or Character Extraction Method. 6.Radix Transformation 2nd YEAR/ 3rd SEMESTER . DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING 6. When Collision Occurs? Collision occurs when a hash value of a record being inserted hashes to an address that already contains different record.(ie) when 2 key values hash to the same position. 7. What is collision Resolution? It is the process of finding another position for the collide record. 8. List the Collision Resolution Techniques? 1.Separate Chaining. 2.Open Addressing 3.Multiple Hashing. 9.what is separate Chaining? It is an open Hashing Technique. A pointer field is added to each record location .when an overflow occurs this pointer is set to point to overflow blocks making a linked list. 10.What is the advantage of Separate Chaining? More number of elements can be inserted as it uses array of linked lists. 11.What are the Disadvantages of Separate Chaining? 1.It requires pointers , which occupies more memory space . 2.It takes more effort to perform a search ,since it takes time to evaluate hash function and also to traverse the list. 12.Define Open Addressing. It is also called as Closed Hashing ,which is an alternative to resolve the collisions with linked lists. 13.What are the Collision resolution strategies? 1.Linear Probing 2.Quadratic Probing. 3.Double Hashing. 14.What is Linear Probing? In Linear Probing ,the position in which a key can be stored is found by sequentially searching all position starting from the position calculated by the hash function until an empty cell is found. EE2204 – DATA STRUCTURES & ALGORITHMS . DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING 15.What is the advantage of Linear Probing? It does not require Pointers. 16. What is the disadvantage of Linear Probing? It forms clusters ,which degrades the performance of the hash table for storing and retrieving data. 17.What is Binary Heap? The efficient way of implementing priority queue is Binary Heap. 18.What are Heap Properties? 1.Structure Property 2.Heap order Property. 19.What are the basic operations of Binary Heap? 1.Insertion 2.Delete Min 20.What are the other operations of Heap? 1.Decrease Key. 2.Increase Key. 3.Delete. 4.Build Heap. 21.What is B-Tree? B-Trees are balanced M-way trees, which are well suited for disks. 22.What are the B-Tree Properties? 1.Root is either a leaf or has between 2 and M children. 2.All no leaf nodes have between M/2 and M children. All leaves are at same depth. 23.what are the uses of trees? Trees are used in operating system, compiler design and searching. 2nd YEAR/ 3rd SEMESTER . DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING 24.Draw the AVL Tree. PART - B 1.Write a routine to develop the AVL Tree. 2.Write a function to perform insertion and deletion in a binary heap. 3.Write a routine to perform insertion into a B-tree. 4.Define Hash function .Write routines to find and insert an element in separate chaining. 5.Explain open addressing?. UNIT –IV PART - A 1. Define Graph A graph G=(V,E) consists of a set of Vertices ,V and set of Edges E. 2. What is Digraph? It is a graph which consists of directed edges ,where each edge in E is unidirectional. 3. What is undirected graph? It is a graph ,which consists of undirected edges. EE2204 – DATA STRUCTURES & ALGORITHMS . DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING 4.What is weighted graph? A graph is said to be weighted graph if every edge in the graph is assigned a weight or value. 1 1 2 5.What is complete Graph? It is a graph in which there is an edge between every pair of vertices.A complete graph with n vertices will have n(n-1) / 2 edges. 6.What is strongly connected Graph? 2nd YEAR/ 3rd SEMESTER . DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING If there is path from every vertex to every other vertex in a directed graph then it is said to be Strongly connected graph. 7.what is path? It is a sequence of vertices W1,W2……..Wn . 8.What is DAG? A directed graph which has no cycles is referred as acyclic graph. 9.What are the different ways of representing a graph? Adjacency Matrix EE2204 – DATA STRUCTURES & ALGORITHMS . DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING Adjacency List 10.What is the advantage of Adjacency Matrix Representation? Simple to implement. 11. What are the disadvantages of Adjacency Matrix Representation? Takes O(n2) space to represent the graph. Takes O(n2) time to solve the most of the problems. 12.What is Adjacency List representation? In this we store all vertices in a list and then for each vertex ,we have a linked list of its adjacency vertices. 13.what is the disadvantage of Adjacency List? It takes O(n) time to determine whether there is an arc from vertex i to vertex j. 14.What is topological sort? It is linear 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 linear ordering. 15.What is graph traversal? It is a systematic way of visiting the nodes in a specific order . 16.Name any two graph traversal. Depth First Traversal Breadth First Traversal. 17.What is the Application of Breadth First Search? To check whether the graph is connected or not. 18.Name the two types of shortest path problems. The single source shortest path problem. The all pairs shortest path problem. 19.List any two algorithm for Minimum Spanning Tree? Prim‟s Algorithm. Kruskal‟s Algorithm 2nd YEAR/ 3rd SEMESTER . DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING 20.What is Depth First Search? It works by selecting one vertex as start vertex.V is marked as visited.Then each unvisited vertex adjacent to V is searched in turn using Depth first search recursively. 21.What are the applications of DFS? 1.To check whether the undirected graph is connected or not. 2.To check whether the connected undirected graph is Bioconnected or not. 3.To check the Acyclicity of the directed graph. 22.What is Bioconnectivity? A connected undirected graph is bioconnected if there are no vertices whose removal disconnects the rest of the graph. 23.What is Euler Path? A graph is said to be Euler path if it can be traced in 1 sweep without lifting the pencil from the paper and without tracing the same edge more than once. 24.What is Euler’s Circuit? Euler‟s Circuit is similar to an Euler path,except that the starting and ending points must be same. 25.List some of the examples of NP Complete Problems? Hamilton Circuit Travelling Salesman Problem. Knapsack ,graph coloring , Bin Packing and Partition problem. PART – B 1. What is topological sort?Write down the pseudocode to perform topological sort? 2. Explain Prim‟s and Kruskal‟s algorithm in detail? 3. Explain bioconnectivity? 4. Explain depth first traversal? EE2204 – DATA STRUCTURES & ALGORITHMS . DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING UNIT – V PART - A 1. What is Greedy Algorithm? It works in Phases.In each phase a decision is made considering the local optimum at that time that appears to be good,without considering the future consequences. 2. List some of the techniques that follows Greedy Techique? Dijkstras Shortest path algorithm. Kruskal‟s algorithm Prim‟s algorithm 3. List the applications that uses greedy technique? Coin Change Job Scheduling File Compression Bin Packing 4. What is Huffman’s algorithm? It works by selecting two characters having the lowest probabilities and replacing them with a single character whose probability is the sum of the probabilities of two characters. 5.What is bin packing? This algorithm pack the items in the fewest number of bins,where each bin has unit capacity 6.What are the different versions of bin packing algorithm? Online algorithm Offline algorithm. 7.What is Next Fit? It checks to see whether the item fits in the same bin as the last item. If it does, it is placed there, otherwise new bin is created. 8.what are the advantages of Next Fit? Simple to implement Runs in linear time. 2nd YEAR/ 3rd SEMESTER . DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING Easy to analyze the worst-case behavior. 9.what is the disadvantage of Next Fit ? Wastage of Space. 10.What is First Fit? The first fit strategy scans the bins in order and place the new item in the first bin that is large enough to hold it. 11.What are the advantages of First Fit? Simple to implement. Runs in O(N2) as well as O(N log N) 12.What is the disadvantage of First Fit? Wastage of memory. 13.What is Best Fit? The best fit strategy places a new item in the highest among all bins instead of placing in the first spot that is found. 14. What are the advantages of Best Fit? Performance is more than next fit and first fit. Less wastage of memory. 15. What is the disadvantage of Best Fit? Does not perform better for random inputs. 16. What is offline algorithm? In this all items are read first and sorted placing the largest items first.Then apply the first fit or best fit. 17. What is Divide and Conquer Technique? Divide: Smaller problems are solved recursively. Conquer: The solution to the original problem is then formed from the solutions to the sub problems. 18. What are the classic examples of Divide and Conquer? Merge Sort EE2204 – DATA STRUCTURES & ALGORITHMS . DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING Quick Sort Binary Search Matrix Multiplication 19.What are the applications that uses Divide and Conquer Technique? Computational Geometry. Closest points problem The selection problem 20.What is the running time of Divide and Conquer algorithm for merge sort? T(N)=2T(N/2)+O(N) 21.What is dynamic programming? It is a technique for solving problems with overlapping sub problems. E+ 8425A 12 10 22 19 B C 22.Give some examples for dynamic programming? All-pairs shortest path Optimal binary search tree Ordering of Matrix Multiplication. 23.What is the application of Optimal Binary Search Trees? To implement dictionary ,a set of elements with the operations of searching , insertion and deletion. 24.What is Back tracking algorithm? It is a search technique to replace the last component of the partially constructed solution with next option. 25.Give example for Backtracking algorithm? 1.The turnpike reconstruction problem 2.To select moves in computer games such as chess and checkers. 26. Give some examples for Branch and Bound algorithm? Assignment Problem Knapsack Problem 2nd YEAR/ 3rd SEMESTER