END-TERM EXAMINATION

Similar documents
Department of Computer Applications. MCA 312: Design and Analysis of Algorithms. [Part I : Medium Answer Type Questions] UNIT I

Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest. Introduction to Algorithms

Introduction to Algorithms Third Edition

CS521 \ Notes for the Final Exam

L.J. Institute of Engineering & Technology Semester: VIII (2016)

Sankalchand Patel College of Engineering - Visnagar Department of Computer Engineering and Information Technology. Assignment

DESIGN AND ANALYSIS OF ALGORITHMS

INSTITUTE OF AERONAUTICAL ENGINEERING

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

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

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

Review of course COMP-251B winter 2010

n 2 C. Θ n ( ) Ο f ( n) B. n 2 Ω( n logn)

( ) 1 B. 1. Suppose f x

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

CLASS: II YEAR / IV SEMESTER CSE CS 6402-DESIGN AND ANALYSIS OF ALGORITHM UNIT I INTRODUCTION

( D. Θ n. ( ) f n ( ) D. Ο%

Solutions to Exam Data structures (X and NV)

CS161 - Final Exam Computer Science Department, Stanford University August 16, 2008

9. Which situation is true regarding a cascading cut that produces c trees for a Fibonacci heap?

ECE250: Algorithms and Data Structures Final Review Course

( ) D. Θ ( ) ( ) Ο f ( n) ( ) Ω. C. T n C. Θ. B. n logn Ο

Virtual University of Pakistan

n 2 ( ) ( ) Ο f ( n) ( ) Ω B. n logn Ο

( ) + n. ( ) = n "1) + n. ( ) = T n 2. ( ) = 2T n 2. ( ) = T( n 2 ) +1

Chapter 9 Graph Algorithms

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

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

n 2 ( ) ( ) + n is in Θ n logn

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

5105 BHARATHIDASAN ENGINEERING COLLEGE

Contents. 1 Introduction. 2 Searching and Traversal Techniques. Preface... (vii) Acknowledgements... (ix)

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

15CS43: DESIGN AND ANALYSIS OF ALGORITHMS

1. To reduce the probability of having any collisions to < 0.5 when hashing n keys, the table should have at least this number of elements.

Chapter 9 Graph Algorithms

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

Test 1 Last 4 Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. 2 points each t 1

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

SUGGESTION : read all the questions and their values before you start.

CSci 231 Final Review

4.1.2 Merge Sort Sorting Lower Bound Counting Sort Sorting in Practice Solving Problems by Sorting...

Review for Midterm Exam

1 Format. 2 Topics Covered. 2.1 Minimal Spanning Trees. 2.2 Union Find. 2.3 Greedy. CS 124 Quiz 2 Review 3/25/18

Graph Algorithms (part 3 of CSC 282),

1. [1 pt] What is the solution to the recurrence T(n) = 2T(n-1) + 1, T(1) = 1

CS6402 DESIGN AND ANALYSIS OF ALGORITHMS QUESTION BANK UNIT I

Contents. CS 124 Final Exam Practice Problem 5/6/17. 1 Format and Logistics 2

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

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

Lecture Summary CSC 263H. August 5, 2016

Student number: Datenstrukturen & Algorithmen page 1

INTERNATIONAL INSTITUTE OF MANAGEMENT, ENGINEERING & TECHNOLOGY, JAIPUR (IIMET)

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

R13 SET - 1. ''' '' ''' ' blog: anilkumarprathipati.wordpress.com. Code No: RT32054

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: CS6402- Design & Analysis of Algorithm Year/Sem : II/IV UNIT-I INTRODUCTION

Midterm solutions. n f 3 (n) = 3


Chapter 9 Graph Algorithms

COMP 251 Winter 2017 Online quizzes with answers

Your favorite blog : (popularly known as VIJAY JOTANI S BLOG..now in facebook.join ON FB VIJAY

Design and Analysis of Algorithms - - Assessment

Problem 1. Which of the following is true of functions =100 +log and = + log? Problem 2. Which of the following is true of functions = 2 and =3?

Analysis of Algorithms

DESIGN AND ANALYSIS OF ALGORITHMS

Multiple Choice. Write your answer to the LEFT of each problem. 3 points each

APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY THIRD SEMESTER B.TECH DEGREE EXAMINATION, JULY 2017 CS205: DATA STRUCTURES (CS, IT)

Model Answer. Section A Q.1 - (20 1=10) B.Tech. (Fifth Semester) Examination Analysis and Design of Algorithm (IT3105N) (Information Technology)

CS-6402 DESIGN AND ANALYSIS OF ALGORITHMS

Course Review for Finals. Cpt S 223 Fall 2008

Algorithm Design (8) Graph Algorithms 1/2

Test 1 - Closed Book Last 4 Digits of Student ID # Multiple Choice. Write your answer to the LEFT of each problem. 3 points each

University of New Mexico Department of Computer Science. Final Examination. CS 362 Data Structures and Algorithms Spring, 2006

Graph Algorithms (part 3 of CSC 282),

Data Structures and Algorithms Course Introduction. Google Camp Fall 2016 Yanqiao ZHU

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))

Lecture 13. Reading: Weiss, Ch. 9, Ch 8 CSE 100, UCSD: LEC 13. Page 1 of 29

D.K.M.COLLEGE FOR WOMEN (AUTONOMOUS), VELLORE-1.

Final Examination CSE 100 UCSD (Practice)

Total No. of Questions : 18] [Total No. of Pages : 02. M.Sc. DEGREE EXAMINATION, DEC First Year COMPUTER SCIENCE.

Dijkstra s Algorithm Last time we saw two methods to solve the all-pairs shortest path problem: Min-plus matrix powering in O(n 3 log n) time and the

Cs502 Solved MCQS MidTerm

DATA STRUCTURES AND ALGORITHMS

Dijkstra s algorithm for shortest paths when no edges have negative weight.

How many leaves on the decision tree? There are n! leaves, because every permutation appears at least once.

Lecture 6 Basic Graph Algorithms

Exam 3 Practice Problems

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE

CIS 121 Data Structures and Algorithms Midterm 3 Review Solution Sketches Fall 2018

FINAL EXAM SOLUTIONS

CS 125 Section #10 Midterm 2 Review 11/5/14

University of Toronto Department of Electrical and Computer Engineering. Midterm Examination. ECE 345 Algorithms and Data Structures Fall 2012

CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims. Lecture 25: Review and Open Problems

UML CS Algorithms Qualifying Exam Fall, 2003 ALGORITHMS QUALIFYING EXAM

Instructions. Definitions. Name: CMSC 341 Fall Question Points I. /12 II. /30 III. /10 IV. /12 V. /12 VI. /12 VII.

NP-Completeness. Algorithms

looking ahead to see the optimum

Announcements. CSEP 521 Applied Algorithms. Announcements. Polynomial time efficiency. Definitions of efficiency 1/14/2013

Data Structures and Algorithm Analysis in C++

Topic Analysis PART-A

Transcription:

(Please Write your Exam Roll No. immediately) Exam. Roll No... END-TERM EXAMINATION Paper Code : MCA-205 DECEMBER 2006 Subject: Design and analysis of algorithm Time: 3 Hours Maximum Marks: 60 Note: Attempt all question as directed. All questions have internal choice. Q. 1. Attempt any four parts :- (3 x 4 =12) (a) Solve the recurrence relation by iteration T(n) = T(n-1) + n 4. (b) Show that the solution of T(n) = T( n/2 ) + 1 is 0(log n). (c) Apply quick sort algorithm on the following list 10, 2, 12, 7, 4, 6, 9, 5, 1, 3, 11, 0. (d) Show that the merge sort algorithm follows divide and conquer paradigm. (e) Write an algorithm for linear search and find its complexity. (f) What is stable algorithm? Q. 2. Attempt any three parts:- (4 x 3 =12) (a) Find the longest common subsequence of Author-affil refers to the affiliation of author X = <A, B, C, D, A, B> Y = <B, D, C, A, B, A> (b) Construct the Huffman codes for first eight Fibonacci number. (c) Compare dynamic programming and divide and conquer paradigm. (d) Let n = 5, (P 1, P 2,., P 5 ) = (20, 15, 10, 5, 1) and (d 1 -d 5 ) = (2, 2, 1, 3, 3). Find the optimal schedule. (e) Write three operations and their implementation on disjoint sets. (f) What is optimal binary search tree? Q. 3. Attempt any two parts :- (6 x 2 =12) (a) Suppose the dimensions of matrices A, B, C, D are 20 x 2, 2 x 15, 15 x 40 and 40 x 4 respectively. What will be the optimum number of scalar multiplications? (b) Write Dijkstra algorithm to solve single source shortest path problem and analyze its time-complexity. (c) How the Bellman-ford algorithm is used to detect the presence of negative edge cycle in the given graph?

Q. 4. Attempt any two parts :- (6 x 2 =12) (a) Write PRIM s algorithm for finding out minimum spanning tree and derive its complexity. (b) Use Floyd Warshall s algorithm to find the shortest path between all pair of vertices in the graph? 2 3 4 8 1 3 5 4 (c) Give the Knuth-Morris-Pratt algorithm for pattern matching. Discuss its performance and failure functions. Q. 5. Attempt any two parts :- (6 x 2 =12) (a) Discuss the Strassen s algorithm for matrix manipulation. Show that two n x n matrices can be in θ (n log7 2 ) time.. (b) Prove that satisfiability of Boolean formula in 3-conjunctive normal form (3- CNF) is NP-Complete. (c) Analyze the time complexity of Rabin-Karp algorithm. ----------------------------------------

(Please Write your Exam Roll No. immediately) Exam. Roll No... END-TERM EXAMINATION Third Semester [MCA] - DECEMBER 2005 Paper Code: MCA 205 Subject: Design and Analysis of Algorithm Time: 3 Hours (Batch-2004) Maximum Marks: 60 Note: Attempt five questions in all, including Q. 1 which is compulsory. Q. 1. (a) Given three functions (n!, n n and 2 2n ), which has the largest growth rate and which the smallest? (2) (b) Is merge sort a stable sorting algorithm? Justify your answer. (2) (c) What is the similarity and difference of dynamic programming and divideand-conquer? (2) (d) Will either Kruskal s or Prim s algorithm work correctly on graphs that have negative edge weights? (1) (e) When a problem is said to be polynomially reducible? (1) (f) What is an optimal binary search tree? (1) (g) What is a Huffman tree? (1.5) (h) What are the time complexities of Quick Sort? (1.5) Q. 2. (a) Explain the various asymptotic notations used to analyze an algorithm. (5) (b) Solve the recurrence relation for the no. of key comparisons made by merge sort in the worst case. (You may assume that n =2 k ). (4) (c) Define Master Theorem. (3) Q. 3. (a) Design a H (n 2 ) algorithm for finding an optimal binary search tree. (6) (b) Consider the problem of scheduling n jobs of known duration s t 1, t 2,.. t n for execution by a single processor. The jobs can be executed in any order, one job at a time. You want to find a schedule that minimizes the total time spent by all the jobs in the system. Design a Greedy algorithm for this problem. (The time spent by one job is the sum of waiting time and execution time). (6) Q. 4. (a) Apply Kruskal s algorithm to find a minimum spanning tree of the following graph. (5) 5 1 6 6 3 4 6 6 6 6 6 2 (b) Prove the correctness of Kruskal s algorithm. (5) (c) Define disjoint subsets. (2)

Q. 5. (a) Give an O (V+E)-time algorithm to compute the component graph of a directed graph G = (V, E). Make sure that there is at most one edge between two vertices in the component graph your algorithm produces. (6) (b) Let Ax b be a system of m difference constraints in n unknowns. Show that the Bellman-Ford algorithm, when run on the corresponding constraints graph, maximizes Σ x i subject to Ax b and x i 0 for all x i (6) i =1 Q. 6. (a) Explain Rabin-Karp algorithm for string matching. What is its worst case running time? (6) (b) What do you mean by string-matching automata? Write a pseudo code to compute the transaction function δ from a given pattern P [1..m]. (6) Q. 7. (a) Show that the class P, viewed as a set of languages, is closed under union, intersection, concatenation, complement. (6) (b) A clique in an undirected graph G= (V, E) is a subset V CV of vertices, each pair of which is connected by an edge in E. The size of a clique is the no. of vertices it contains. The clique problem is the optimization problem of finding a clique of maximum size in a graph. Prove that the clique problem is NP-complete. (6) Q. 8. Write notes on following:- (12) (i) Strassen s algorithm for Matrix Multiplication (ii) The Knuth-Morris-pratt algorithm. (iii) Strongly connected components. ----------------------------------------

(Please Write your Exam Roll No. immediately) Roll No... END-TERM EXAMINATION Third Semester [MCA] - DECEMBER 2004 Paper Code: MCA 209 Subject: Design and Analysis of Algorithm Time: 3 Hours Maximum Marks: 60 Note: Attempt any five questions. Q. 1. (a) Define Heap and explain heap sort algorithm. (7) (b) Prove that time complexity of heap rest algorithms is O (n lg n). (5) Q. 2. (a) How disjoint sets are represented any using linked list? Give algorithms for union and find operation on disjoint sets represented using linked list and weighted union heuristic. (8) (b) Prove that sequence of m Makeset, union and find operations, n of which are makeset operations, takes O(m + n lg n) time, when disjoint sets are represented using linked list and weighted union heuristics. (4) Q. 3. (a) Discuss Prim s algorithm for finding minimum cost spanning tree of a graph. (7) (b) Using Prim s algorithm find minimum cost spanning tree for following graph. (5) b 2 d 2 f 2 4 3 1 a 3 2 h 2 1 2 1 1 c e g Q. 4. (a) Explain algorithm for depth first search of a graph. (6) (b) Using DFS give algorithm for finding strongly connected components of a graph and prove its correctness. (6) Q. 5. (a) Define P, NP and NP complete clan of problems. (6) (b) Prove vertex cover problem is NP-complete. (6) Q. 6. (a) Discuss finite automata based string matching algorithm. (6)

(b) Construct string matching automation for the pattern (6) P= aabab and illustrate its operation on string T= aaababaabaababaab Q. 7. (a) Define transitive closure and give algorithm for finding transitive closure of a graph. (6) (b) Explain radix sort algorithm. (6) Q. 8. Write short notes on (12) (a) Hash functions & Hashing Techniques (b)graph coloring problem. ----------------------------------------

(Please Write your Exam Roll No. immediately) Roll No... END-TERM EXAMINATION Third Semester [MCA] - DECEMBER 2003 Paper Code: MCA 209 Subject: Design and Analysis of Algorithm Time: 3 Hours Maximum Marks: 60 Note: Attempt any five questions. Q. 1. (a) Let f(n) and g(n) be asymptotically non-negative functions. Using the basic definition of Θ notation, prove that max (f(n), g(n)) = Θ (f(n) + g(n)). (4) (b) Show that for any real constants a and b, where b> 0, (n + a) b = Θ (n b ). (4) (c) Explain why the statement, the running time of algorithm A is at least O(n 2 ), is meaningless. (4) Q. 2. (a) What do you understand by the term Stability of a sorting algorithm. Use induction to prove that radix sort works. Where does your proof need the assumption that the intermediate sort is stable? (7) (b) Show how to sort n integers in the range 0 - n 2 in O(n) time. (5) Q. 3. (a) Demonstrate the insertion of the keys 5, 28, 19, 15, 20, 33, 12, 17, 10 into a hash table with collisions resolved by chaining. Let the table have 9 slots, and let the hash function be h(k) = k mod 9. (6) (b) Prove that in a hash table with collision resolution by chaining, an unsuccessful search takes expected time Θ (1 + α), where α is the load factor. (6) Q. 4. (a) As a function of the minimum degree t, what is the maximum number of keys that can be stored in a B tree of height h? (6) (b) If FIND-SET (x) returns a pointer to the representative of the (unique) set containing the element x. Prove that the amortized cost of each FIND-SET operation is O (α (n)). (6) Q. 5. Give the Bellman Ford algorithm and prove its correctness. (12) Q. 6. (a) The Dijkstra s algorithm does not work for negative weight path. Why? (4) (b) Establish that five colors are sufficient to color any simple connected planer graph. (8) Q. 7. Describe a finite automation based string matching algorithm. Explain its working with an example. (12)

Q. 8. Write short notes on any two :- (12) (a) P, NP, NP Complete class of problems (b) Random number generation and test for randomness (c) Transitive closure of relations and associative algorithms. ----------------------------------------

(Please Write your Exam Roll No. immediately) Roll No... END-TERM EXAMINATION Third Semester [MCA] - DECEMBER 2002 Paper Code: MCA 209 Subject: Design and Analysis of Algorithm Time: 3 Hours Maximum Marks: 60 Note: Attempt any five questions. Q. 1. (a) Solve the recurrence relations (6) T n = 2 if n = 2 2T (n/2) + n if 2 k, 2>1 (b) Prove that (6) Log (n!) = θ (n log n) and n!=θ(n n ) Q. 2. (a) Define the tree data structure. Write an algorithm to find the height of a binary tree. Analyze the time complexity of your algorithm. (6) (b) Write an algorithm to calculate the number of descendants of each vertex in a tree. Analyze the time and space complexity of algorithm. (6) Q. 3. (a) Consider a rectangular array (of numbers). Sort the elements in each row into increasing order. Next sort the elements in each column into increasing order. Prove that the elements in each row remain sorted in your algorithm. (10) (b) What is meant by the phrase a stable sorting algorithm? (2) Q. 4. Write the algorithm to take the union of two disjoint sets. Explain the data structure used by your algorithm. Provide an example explaining your algorithm and discuss whether for your algorithm n-1 UNION operations can be executed in O ( n log n) steps. (12) Q. 5. (a) Define the following terms. (4) (i) Bi-connectivity (ii) Strong connectivity (b) State the Diskstra s algorithm for single-source shortest path finding. Explain its working with an example. (8)

Q. 6. (a) Explain the linear congruential method of pseudo-random number generations. What are the recommended constant (of the rule) relationship that provide the longest non-repeating sequence. (6) (b) With an example explain why the worst case behavior of quick sort is O(n 2 ). (6) Q. 7. (a) Design a finite automation that recognizes the regular expression (6) (a + b) * aba (b) Explain the Rakin - karp pattern/string matching algorithm. What is its worst case running time? (6) Q. 8. Write short notes on any two :- (12) (a) Importance of NP complete problems (b) Radix sort (c) Binary search Tree (d) Non-deterministic Turing machines. ----------------------------------------

(Please Write your Exam Roll No. immediately) Roll No... END-TERM EXAMINATION Third Semester [MCA] - JANUARY 2001 Paper Code: MCA 209 Subject: Design and Analysis of Algorithm Time: 3 Hours Maximum Marks: 70 Note: Attempt any five questions including Q. No. 1 which is compulsory. Q. 1. (a) Define big O notation. Determine the order of following function giving reasons: (5) (i) 2n + 2 (ii) 6 * 2 n + n 2 (b) Write short notes on hashing. (5) (c) Show that complement of a regular set is a regular set. (4) (d) Prove by mathematical induction that 8 n - 3 n is a multiple of 5. (4) (e) Find the general solution of the following recurrence relation: (4) T(K) 3T (K-1) 4T (K-2) = 4 k (f) What is Graph? Describe some methods of representation of Graph. (4) Q. 2. Define binary search tree with suitable example. Write an algorithm to search a binary tree T for an identifier X. What is the computing time of this algorithm? (11) Q. 3. (a) Explain Heap Sort Algorithm. (6) (b) Sort the following data using Heap Sort (5) 88, 12, 91, 23, 10, 36, 45, 55, 15, 39, 81, 97, 61 Q. 4. (a) Give an efficient algorithm for disjoint set Union. Find problem using tree structure. (7) (b) Find the time complexity of algorithm of part (a). (4) Q. 5. (a) Explain Kruskal s algorithm for finding Minimum Cost Spanning Tree in a Graph. (7) (b) Using algorithm of part (a) find minimum cost spanning tree of the following graph. (4) V 20 1 V 2 23 1 4 15 36 9 V 6 V 7 V 3 25 16 28 3 V 5 V 4 17

Q. 6. (a) Draw the finite automata for the regular expression ab*+c (6) (b) Prove the theorem that if L is a regular set then L is accepted by a DFA. (5) Q. 7. (a) Define Non deterministic Turing Machine and NP complete problems. (5) (b) Define vertex cover problem and prove that it is NP complete. (6) ----------------------------------------