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

Similar documents
DESIGN AND ANALYSIS OF ALGORITHMS

END-TERM EXAMINATION

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

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

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

5105 BHARATHIDASAN ENGINEERING COLLEGE

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

Introduction to Algorithms Third Edition

DESIGN AND ANALYSIS OF ALGORITHMS

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

15CS43: DESIGN AND ANALYSIS OF ALGORITHMS

COMP 251 Winter 2017 Online quizzes with answers

CS6402 DESIGN AND ANALYSIS OF ALGORITHMS QUESTION BANK UNIT I

INSTITUTE OF AERONAUTICAL ENGINEERING

Analysis of Algorithms

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

Midterm solutions. n f 3 (n) = 3

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.

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

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

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

Topic Analysis PART-A

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

CS521 \ Notes for the Final Exam

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

2. (a) Explain when the Quick sort is preferred to merge sort and vice-versa.

( ) 1 B. 1. Suppose f x

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

CS-6402 DESIGN AND ANALYSIS OF ALGORITHMS

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of MCA

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

Chapter 9 Graph Algorithms

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

Analysis of Algorithms

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

ECE250: Algorithms and Data Structures Final Review Course

Chapter 9 Graph Algorithms

Chapter 9. Greedy Technique. Copyright 2007 Pearson Addison-Wesley. All rights reserved.

CSCE 321/3201 Analysis and Design of Algorithms. Prof. Amr Goneid. Fall 2016

Chapter 9 Graph Algorithms

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

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

PSD1A. DESIGN AND ANALYSIS OF ALGORITHMS Unit : I-V

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

4. Give the diagram representation of Notion of algorithm. [M 13]

looking ahead to see the optimum

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

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

CAD Algorithms. Categorizing Algorithms

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

Anany Levitin 3RD EDITION. Arup Kumar Bhattacharjee. mmmmm Analysis of Algorithms. Soumen Mukherjee. Introduction to TllG DCSISFI &

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

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

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

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

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

CSE 100: B+ TREE, 2-3 TREE, NP- COMPLETNESS

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

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

CSci 231 Final Review

2. True or false: even though BFS and DFS have the same space complexity, they do not always have the same worst case asymptotic time complexity.

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

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

Lecture 1. Introduction


Greedy Approach: Intro

Lecture Summary CSC 263H. August 5, 2016

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

Design and Analysis of Algorithms

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

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

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

Final Examination CSE 100 UCSD (Practice)

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

IV/IV B.Tech (Regular) DEGREE EXAMINATION. Design and Analysis of Algorithms (CS/IT 414) Scheme of Evaluation

CSE 431/531: Algorithm Analysis and Design (Spring 2018) Greedy Algorithms. Lecturer: Shi Li

Ph.D. Comprehensive Examination Design and Analysis of Algorithms

( ) n 5. Test 1 - Closed Book

Test points UTA Student ID #

6. Algorithm Design Techniques

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

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

Overview of Data Structures, Algorithm Analysis

Cs502 Solved MCQS MidTerm

CS 161 Fall 2015 Final Exam

Graph Algorithms (part 3 of CSC 282),

Algorithm Analysis. (Algorithm Analysis ) Data Structures and Programming Spring / 48

DATA STRUCTURES AND ALGORITHMS

TOTAL CREDIT UNITS L T P/ S SW/F W. Course Title: Analysis & Design of Algorithm. Course Level: UG Course Code: CSE303 Credit Units: 5

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

Design and Analysis of Algorithms - - Assessment

2. (a) Explain the concept of virtual functions in C++ with suitable examples. (b) Explain the concept of operator overloading in C++.

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

AC64/AT64 DESIGN & ANALYSIS OF ALGORITHMS JUN 2015

INSTITUTE OF AERONAUTICAL ENGINEERING

CS 373: Combinatorial Algorithms, Spring 1999

UNIT 3. Greedy Method. Design and Analysis of Algorithms GENERAL METHOD

Lecturers: Sanjam Garg and Prasad Raghavendra March 20, Midterm 2 Solutions

FINAL EXAM SOLUTIONS

Transcription:

MCA 312: Design and Analysis of Algorithms [Part I : Medium Answer Type Questions] UNIT I 1) What is an Algorithm? What is the need to study Algorithms? 2) Define: a) Time Efficiency b) Space Efficiency 3) Briefly discuss the Algorithm Analysis Framework. Write a note on measuring the input size of an algorithm. What are different ways of measuring the running time of an algorithm? 4) What is Order of Growth? Define Worst case, Average case and Best case efficiencies. 5) Explain the Linear Search algorithm. 6) Give the general plan for analyzing the efficiency of Recursive algorithms with an eg. 7) Give an algorithm to find the smallest element in a list of n numbers and analyze the efficiency. 8) Give an algorithm to check whether all the elements in a list are unique or not and analyze the efficiency. 9) State the Master theorem and its use. 10) Explain the Quick Sort algorithm with an example and also draw the tree structure of the recursive calls made. Analyze the efficiency of Quick sort algorithm. 11) What is the solution of the recurrence T(n) = T(n/2) + n log n, T(1) = 1? 12) How much time does the following algorithm require as a function of n: m 0 for i 1 to n do for j n 2 do for k 1 to n 3 do m m + 1 UNIT II 1) Give the algorithm to find the height of a Binary tree and analyze the efficiency. 2) Explain Strassen s Matrix multiplication with an example and analyze the efficiency. 3) Give the Insertion Sort algorithm and analyze the efficiency. 4) Give an algorithm to multiply two matrices of order N * N and analyze the efficiency. 5) What is Heap? What are the different types of heaps? Explain how do you construct heap? Explain the Heap Sort algorithm with an example. Question Bank of MCA 312: Design and Analysis of Algorithm Page 1/7

6) Apply Quick sort algorithm to sort the list E,X,A,M,P,L,E in alphabetical order. Draw the tree of recursive calls made. 7) Explain the Merge Sort algorithm with an example and also draw the tree structure of the recursive calls made. Analyze the efficiency of Merge sort algorithm 8) Suppose that we had defined AVL trees to be binary search trees in which, for each node v, the heights of the left and right subtrees of v differ by at most 2 (instead of at most 1). Let ah be the minimum possible number of keys in such a tree of height h. (Define height as the length of the longest path from the root to an external node (i.e., to a leaf in the extended tree.) Then a0 = 0, a1 = 1, and a2 = 2. Give a recurrence for the value of ah when h = 3. (You don t have to solve the recurrence.) 9) Give the Binary search algorithm and analyze the efficiency. 10) Write an algorithm for finding the largest key in a B-Tree. 11) Construct a 2-3 tree for the list 9,5,8,3,2,4,7 12) Show that Two Binomial heaps can be combined in O(log n) steps where the total number of nodes in the two trees is n. UNIT III 1) What are Huffman trees? Explain how to construct Huffman trees with an eg. 2) Explain the subset sum problem with an example. 3) Explain the Branch and Bound technique with an example. 4) What is amortized efficiency? 5) Write an algorithm for multiplying two square matrices of order n. What is the time complexity of the algoritm?explain. 6) Write a pseudo code for a divide and conquer algorithm for finding values of both the largest and the smallest elements in any array of n numbers 7) Explain Divide and Conquer technique and give the general divide and conquer recurrence. 8) What is a rotation in AVL tree used for? Write about the efficiency of AVL trees? 9) Explain the concept of Backtracking with an example. How is it implemented in knapsack problem. 10) What is n-queen s problem? Generate the state space tree for n = 4. UNIT IV 1) Draw a decision tree and find the number of key comparisons for the worst and average cases for the three-element basic bubble sort 2) Prove that any weighted connected graph with distinct weights has exactly one minimum spanning tree 3) Write an algorithm for finding an element in an optimal binary search tree 4) Describe Warshall s algorithm for finding the transitive closure of a digraph 5) Construct a heap for the list 1,8,6,5,3,7,4 by successive key insertions (topdown algorithm) Question Bank of MCA 312: Design and Analysis of Algorithm Page 2/7

6) Explain Kruskal s algorithm with an example 7) Explain Dijkstra s algorithm with an example. 8) Explain DFS and BFS with an example and analyze the efficiency 9) Explain Prim s algorithm with an eg. Prove that Prim s algorithm always yields a minimum spanning tree. 10) Write an algorithm for depth first search of a graph and explain with an example 11) In the flow network each direction as is labeled with its capacity. Illustrate Ford-Fulkerson algorithm to find the maximum flow with example. UNIT V 1) What are Decision Trees? Explain. 2) For each of the following assertions, indicate whether it is True: known to be true, False: known to be false, or Unknown: unknown based on our current scientific knowledge. In each case provide a short explanation for your answer. (i) No problems in NP can be solved in polynomial time. (ii) Every NP-complete problem requires at least exponential time to be Solved. 3) Write short note on the following i) Randomized algorithm ii) Approximation algorithm 4) Explain Euclids Algorithm to find the GCD of two integers with an eg. 5) Compute whether the pattern P = 10100111 is present in the string T = 1001010100111 or not. 6) Describe RSA crypto systems. 7) Discuss about data structure for disjoint sets and its algorithms for finding connected components of a graph. 8) Define P, NP and NP-Complete problems. 9) Explain the concept of input enhancement in String Matching 10) Prove that P _ Co-NP: 11) Prove that if NP Co-NP then P NP: Question Bank of MCA 312: Design and Analysis of Algorithm Page 3/7

[Part II : Long Answer Type Questions] UNIT I 1. Write a recurssive algorithm for computing 2^n = 2^(n-1)+2^(n-1) for any positive integer n. Draw a tree of recursive calls for this algorithm and count the number of calls made by the algorithm 2. Suppose we start with the heap below and insert a 35. Show the heap that results. 3. Show that If f(n) = a m n m + a n-1 n m-1 + + a 1 n + a 0. & a m > 0, then f(n) = θ (n m ) 4. Solve the recurrence T(n) = 2T( n/3 ) + n by Iteration Method. 5. Using the master method, give tight asymptotic bounds for the following recurrences: a) T(n) = 4T(n/2) + n 3 b) T(n) = 2T(n/2) + n-1 6. Using the master method, give tight asymptotic bounds for the following recurrences: i) T(n) = 4T(n/2) + n 3 ii) T(n) = 2T(n/2) + n-1 UNIT II 1. Discuss the properties of a Red Black tree. Construct a red-black tree for the following set of data 45, 56, 12, 67, 34, 78, 11. 2. Write pseudo code for following operations: i) RB-INSERT ii) RB-SEARCH iii) RB-CREATE Question Bank of MCA 312: Design and Analysis of Algorithm Page 4/7

iv) RB-DELETE 3. Explain Prim s algorithm with an eg. Prove that Prim s algorithm always yields a minimum spanning tree. 4. Mention the non-recursive algorithm for matrix multiplication? 5. What is Augmented data structure? Write an algorithm to search a key in Interval-Tree 6. Suppose that someone found a way to multiply two n n matrices using only 148 multiplications of n/6 n/6 matrices and Θ (n2) additional work. Assume we used this to produce a recursive divide-and-conquer algorithm for matrix multiplication, similar to Strassen s algorithm. a) Give a recurrence for the number of operations required to multiply two n n matrices by this method. b) Give Θ notation for the number of operations required by this algorithm. UNIT III 1. A thief with a knapsack, can steel n. Each item I i has a certain weight w i and value v i. The maximum capacity of the knapsack is W. Devise an algorithm which fills the knapsack with the maximum possible value. Perform your algorithm over the given set of values. Item I 1 I 2 I 3 Weght 80 30 40 Value 20 15 14 2. Create a Huffman Tree for the following set of data: Characters a b c d e f Probability 48 11 9 14 7 3 And give the decoding of the following strings i) 111000000000111110101010101 ii) 101010101010101010101010101 3. Suppose that the graph below is an Activity-on-Vertex graph for some project. The task durations are shown inside each vertex, and certain vertices have names shown above them. For each of A, B, C, D, and E, show the earliest this task could begin, and the latest it could begin without delaying the overall completion of the project. Question Bank of MCA 312: Design and Analysis of Algorithm Page 5/7

4. Suppose we wish to encode a string by a prefix-free binary code using as few bits as possible (not including the bits needed to specify the code). There are only 6 different characters in the string, and they have these frequencies: a: 5, b: 8, c: 9, d: 10, e: 6, f: 62. Show a code tree that yields an encoding with the fewest total number of bits. In each node of the code tree write the total frequency of all the characters descending from the node (so the root will have the value 100). You may find it easier to draw if you place the leaves in some order other than a,b,c,d,e,f. You do not have to give the actual code for each of the six characters, but do state how long the code for each of the characters would be. 5. Given a set S= ( 1, 3, 5, 4) and X=8, find the subset- sum using backtracking approach. 6. A newspaper agent daily drops the newspaper to the area assigned in such a manner that he has to cover all the houses in the respective area with minimum travel cost and come back to the original position ie newspaper office. Devise an algorithm for the above problem. Given below is the area assigned to the agent where he has to drop the newspaper. The distance from newspaper office to H1 cost 5 units. H 1 4 7 5 H 2 2 8 H 6 3 H 7 6 3 2 4 2 3 H 5 H 8 H 3 1 7 H 4 Compute the minimum travel cost. Question Bank of MCA 312: Design and Analysis of Algorithm Page 6/7

UNIT IV 1. In the flow network, define the terms maximum cut, residual network, augmenting path, capacity and flow.. Use the Ford-Fulkerson algorithm to find the maximum flow in any flow network. 2. Explain Chinese remainder theorem. Illustrate your explanation with the help of an example. 3. What are Huffman trees? Explain how to construct Huffman trees Construct Huffman Tree for the following data set f:5 e:9 c:12 b:13 d:16 a:45 where alphabets represent the data and numbers represent their corresponding frequencies. 4. What is Traveling Salesman Problem (TSP)? Explain with an eg. Give a brute force solution to the TSP. What is the efficiency of the algorithm? 5. Given a weighted, undirected, and connected graph G = (V,E), a maximum spanning tree is a spanning tree of G with the maximum total weight. Design and analyze an algorithm that computes a maximum spanning tree of G. 6. Give the Warshall s algorithm and analyze the efficiency. Explain how do you solve the All-Pairs-Shortest-Paths problem with an example. 1. Explain Graham Scan s Method UNIT V 2. The set cover problem is: Given a finite set X and a collection of sets F whose elements are chosen from X, and given an integer k, does there exist a subset C sunset of F of k sets such that Prove that the set cover problem is NP-complete. 3. Compute whether the pattern P = 31456 is present in the string T = 5678123454212435 or not using Rabin Karp method. The value of q=13. Also give the number of spurious and valid hits. 4. Give the Approximation Algorithm for Travelling Salesman in complete graph, NP- Hard problem with example. 5. Discuss NP-complete problems and also explain minimum vector cover problem in contex to NP completeness with example. Question Bank of MCA 312: Design and Analysis of Algorithm Page 7/7