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

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

INSTITUTE OF AERONAUTICAL ENGINEERING

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

CS6402 DESIGN AND ANALYSIS OF ALGORITHMS QUESTION BANK UNIT I

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

DESIGN AND ANALYSIS OF ALGORITHMS

UNIT 4 Branch and Bound

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

CS6402 Design and Analysis of Algorithm. 2 Marks Question & Answer UNIT I INTRODUCTION

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

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

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

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

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

5105 BHARATHIDASAN ENGINEERING COLLEGE

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

Total No. of Questions :09] [Total No. of Pages : 02

Chapter-6 Backtracking

Branch and Bound. Live-node: A node that has not been expanded. It is similar to backtracking technique but uses BFS-like search.

15CS43: DESIGN AND ANALYSIS OF ALGORITHMS

Backtracking and Branch-and-Bound

DESIGN AND ANALYSIS OF ALGORITHMS

DATA STRUCTURES AND ALGORITHMS

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

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

CS-6402 DESIGN AND ANALYSIS OF ALGORITHMS

Topic Analysis PART-A

INTRODUCTION TO ALGORITHMS

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

INTRODUCTION. An easy way to express the idea of an algorithm (very much like C/C++, Java, Pascal, Ada, )

END-TERM EXAMINATION

Coping with the Limitations of Algorithm Power Exact Solution Strategies Backtracking Backtracking : A Scenario

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

Chapter 9 Graph Algorithms

Chapter 9 Graph Algorithms

Review for Midterm Exam

Assignment No 2 (Group B)

Chapter 6 Backtracking Algorithms. Backtracking algorithms Branch-and-bound algorithms

Practice Problems for the Final

Overview of Data Structures, Algorithm Analysis

Chapter 9 Graph Algorithms

NP-complete Reductions

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

DESIGN AND ANALYSIS OF ALGORITHMS GREEDY METHOD

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

Lecture 3. Brute Force

Multiple Choice Question. Unit-1 Introduction

Sai Nath University. Assignment For B.tech in CS 8 st Sem.

Attendance (2) Performance (3) Oral (5) Total (10) Dated Sign of Subject Teacher

UNIT 1 BASICS OF AN ALGORITHM

DATA STRUCTURE : A MCQ QUESTION SET Code : RBMCQ0305

Search means finding a path or traversal between a start node and one of a set of goal nodes. Search is a study of states and their transitions.

INTRODUCTION. Analysis: Determination of time and space requirements of the algorithm

Final. Name: TA: Section Time: Course Login: Person on Left: Person on Right: U.C. Berkeley CS170 : Algorithms, Fall 2013

CAD Algorithms. Categorizing Algorithms

CSC 8301 Design and Analysis of Algorithms: Exhaustive Search

INTRODUCTION. Objective: - Algorithms - Techniques - Analysis. Algorithms:

CS6402-DESIGN AND ANALYSIS OF ALGORITHM. TWO MARK QUESTION WITH ANSWERS Unit-I. Introduction

Analysis of Algorithms

DATA STRUCTURES AND ALGORITHMS

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

Search Algorithms. IE 496 Lecture 17

Computer Science 385 Design and Analysis of Algorithms Siena College Spring Topic Notes: Brute-Force Algorithms

CMPSCI 311: Introduction to Algorithms Practice Final Exam

Dynamic Programmming: Activity Selection

Introduction to Algorithms

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

6. Algorithm Design Techniques

Data Structures and Algorithms for Engineers

Algorithms and Data Structures

Backtracking. Chapter 5

UNIT 5 BACKTRACKING. BACKTRACKING (General Method)

CMSC Introduction to Algorithms Spring 2012 Lecture 16

CS 350 Final Algorithms and Complexity. It is recommended that you read through the exam before you begin. Answer all questions in the space provided.

Algorithms and Data Structures (INF1) Lecture 15/15 Hua Lu

CS 161 Fall 2015 Final Exam

Algorithms (IX) Guoqiang Li. School of Software, Shanghai Jiao Tong University

DESIGN AND ANALYSIS OF ALGORITHMS

Brute Force: Selection Sort

The Algorithm Design Manual

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

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?

Exam Sample Questions CS3212: Algorithms and Data Structures

Outline and Reading. Analysis of Algorithms 1

CS 440 Theory of Algorithms /

Outline. Graphs. Divide and Conquer.

CMSC351 - Fall 2014, Final Exam

Chapter 6. Dynamic Programming

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

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

Lecture 1. Introduction

LECTURE 9 Data Structures: A systematic way of organizing and accessing data. --No single data structure works well for ALL purposes.

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

Introduction to Data Structure

Design and Analysis of Algorithms - - Assessment

Lecture 4: Graph Algorithms

Reference Sheet for CO142.2 Discrete Mathematics II

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

CS521 \ Notes for the Final Exam

Elementary maths for GMT. Algorithm analysis Part II

Transcription:

IV/IV B.Tech (Regular) DEGREE EXAMINATION Design and Analysis of Algorithms (CS/IT 414) Scheme of Evaluation Maximum: 60 Marks 1. Write briefly about the following 1*12= 12 Marks a) Give the characteristics of an Algorithm? 1. Input, 2. Output, 3. Finiteness, 4. Definiteness, 5. Effectiveness. b) Give the control abstraction of Divide and Conquer. 1. Divide: The problem split into number of sub problems. 2. Conquer: The sub problems by solving recursively. 3. Combine: The solutions to the sub problems into the solution for the original problem. c) Define Adjacency List. A list from the graph, it indicates the adjacency nodes. d) Differentiate Greedy and Dynamic Programming. The main difference is in greedy the problem gets optimal solution, but in the dynamic each sub problem gets optimal solution. e) What is Articulation Point? If we are going to delete a point (or node) in the graph, then it is divided one graph into 2 or more sub graphs. The point is called Articulation Point. f) Give two applications of DFS. Finding strongly connected components, detecting cycles in the graph. g) Define E-node and live node. A node which has generated and all of whose children have not at been generated is called live node. The live node whose children are currently being generated is called E-node. h) Define cycle in the graph. The single path of length at least one that begins and ends at the same point. It s exits in the directed graph. i) What is reliability and how reliability of a system increases? Reliability of a product is defined as the probability that the product will not fail throughout a prescribed operating period. Reliability increases if the number of components decreases. j) State sum of subsets problem. Finding sum of different combinations(from the set) of those elements in the given set is equal to the m(bag size).

k) Define Brach and bound. The branch is going to happen with the satisfactory of the bound. (or) The term Branch and Bound refers to all state space methods in which all the children of the e-node are generated before any live node becomes the e-node. l) Define NP-hard problem. A problem is NP-hard if an algorithm for solving it can be translated into one for solving any NPproblem (nondeterministic polynomial time) problem. NP-hard therefore means at least as hard as any NPhard problem. UNIT- I 2. a) Define terms Time complexity and Space complexity of algorithms. Give a notation for expressing such a complexity and explain the features of such a notation. Time complexity: ----1.5 Mark The time complexity of an algorithm is the amount of computer time it needs to run to completion. Space complexity: ----1.5 Mark The space complexity of an algorithm is the amount of memory it needs to run to completion. Any one of Big-Oh, Omega and Theta notation with definition and example ------3 Marks Big-Oh: The function f(n) =O(g(n)) iff there exist positive constants C & n 0 such that f(n) C * g(n) for all n, n n 0. Omega: The function f(n) = Ω (g(n)) iff there exist positive constants C & n 0 such that f(n) C * g(n) for all n, n n 0. Theta: The function f(n) = Ө(g(n)) iff there exist positive constants C 1, C 2 & n 0 such that C 1 g(n) f(n) C 2 g(n) for all n, n n 0. (Show as like for Big-Oh and Omega also)

2. b) Briefly explain Quick Sort Algorithm with suitable example and Derive its Time Complexity. Algorithm Qsort ( A,m,n) --------2 Marks integer i,j,k,t: if (m < n) i m; j n; k A(m) do do i i+1; } while (A[i] <k) do j j-1; } while ( A[j] >k) if ( i<j) t A[i]; A[i] A[j]; A[j] t; } } while (i>j) t A[m]; A[m] A[j]; A[j] t; Qsort ( A, m, j-1); Qsort (A, j+1, n); } } Time complexity:---2 Marks T(n) = 2T(n/2) + αn = 2(2T (n/4) + αn/2) + αn = 2 2 T (n/4) + 2αn (By simplifying and grouping terms together). = 2 2 (2T (n/8) + αn/4) + 2αn = 2 3 T (n/8) + 3αn = 2 k T (n/2 k) + kαn (Continuing likewise till the k th step) Notice that this recurrence will continue only until n = 2 k (otherwise we have n/2 k < 1), i.e. until k = log n. Thus, by putting k = log n, we have the following equation: T(n) = nt(1) + αn log n, which is O(n log n). Example ----2 Marks

3. a) Explain the pseudo code conventions for writing an algorithm. 1. Comments begin with // and continue until end of the line. 2. Blocks are indicated with matching braces & }. A compound statement can be represented as a block. The body of s procedure alo forms a block. Statements are delimited by ;. 3. An identifier begins with a letter. The data types of variables are not explicitly declared. The types will be clear from the context. Whether a variable is global or local to procedure will also be evident from the context. We assume simple data types such as integer, char, float,.. Compound data types can be formed with records. 4. Assignment of values to variable is done using assignment statement. <var>:= <expression>; 5. There are two Boolean values true & false. In order to produce these values, the logical operators and, or, not and the relational operators <,, =,,, > are provided. 6. Elements of multi dimensional arrays are accessed using [ and ]. 7. The following looping statements are employed for, while, and repeat- until. 8. A conditional statement has following forms if(condition ) then <statement> if(condition) then <statement-1> else <statement-2> 9. Input and output are done using the statements read and write. No format is used to specify the size of i/p or o/p quantities. 10. There is only one type of procedure: Algorithm. An algorithm consists of a heading and body. The heading takes the form: Algorithm <name of algorithm>(<parameters list>) -------6 Marks 3. b) Explain strassen s matrix multiplication with an example. Formulas:----3 Marks P= (a11+ a12) (b11+b22) Q= (a21+a22) b11 R= a11 (b12-b22) S= a22 (b21-b11) T= (a11+a12) b22 U= (a21-a11) (b11+b12) V= (a12-a22) (b21-b22) C11= P+S-T+V C12= R+T C21= Q+S C22= P+R-Q+U Example----3 Marks

UNIT - II 4. a) Define minimum cost spanning tree. State and explain Prim s Minimum cost Spanning tree algorithm with an example. Let G = (V, E) be an undirected connected weightage graph. A sub graph t= (V, E ) of G is a minimum total length spanning tree of G iff t is a tree. -----1 Mark -----2 Marks Example----3 Marks 4. b) What is Travelling Salesman Problem? Apply Dynamic Programming to solve Travelling Salesman Problem. The travelling salesman problem is to find a tour of minimum cost. -----1 Mark Example: -----5 Marks. Input is as like Graph or Adjacency Matrix to relate a graph. 5. a) Explain single source shortest path problem and give the Dijkstra s algorithm to solve single source shortest path problem. To determine the lengths of the shortest paths from one vertex V to each all other vertices in graph G. ----1 Mark Example: -----5 Marks The example is a directed weightage graph with connectivity from one vertex to all each other vertices. 5. b) Explain Longest Common Subsequence Problem with an example? In the given sequences x=x1, x2,,xn., y= y1, y2,.,yn another sequence z=z1, z2,,zn is a subsequence of x and y. Here z is a Longest Common Subsequence. To Obtain LCS the given rules can follow:-------3 Marks

Rule1: 0 if i=0, j=0 C[i.j]= C[i-1, j-1] if i, j= 0 & xi=yj Max (C[i, j-1], C[i-1, j]) if i, j 0 & xi yj Rule2: Xi=yj Then B[i,j]= if C[i-1, j] C[i, j-1] then B[i, j]= else B[i,j]= Example------3 Marks UNIT - III 6. a) Give the Algorithm for DFS and Explain with an example. -----3 Marks Example-----3 Marks 6. b) Write an Algorithm for N- Queens problem and solve the 4-Queens problem by using state space tree. Mainly N queens must place in the n x n chess board without attack each other. No two queens are on the same column, same row and same diagonal.

---------3 Marks Example: solution table-----1 Mark State Space Tree-----2 Marks 7. a) Explain with the help of an algorithm, the mechanism of identifying articulation points and Bi-Connected components in a graph. ------- 3Marks

Example ----3 Marks i) Find DFS for the graph. ii) Assign Depth First Numbers to The Depth First Spanning Tree. iii) Find Least Depth First Numbers to the nodes in the DFS. iv) Identify Articulation Points. 7. b) What is Backtracking? Explain how the knapsack problem is solved using backtracking. Backtracking is a general algorithm for finding all(or one) solutions to some computational problems, notably constraint satisfaction problems, that incrementally builds candidates to the solution and abandons each partial candidate c(backtrack) as soon as it determines that c cannot possibly be completed to a valid solution. (or) To apply backtracking method the desired solution must be expressable as an n-tuples. (x 1, x 2,,x n ) where x i are chosen from some finite set s i. The problem to be solved requires finding one vector which maximizes/ minimizes or satisfies a criteria function. ------2 Marks The problems which are solved by backtracking method require that the solution satisfy a complex set of constraints. These constraints are divided in two classes 1. Implicit: Exact solution for the problem 2. Explicit: The solution space for the problem Example of knapsack problem. -------5 Marks UNIT - IV 8. a) Draw the portion of the state space tree generated by LC Branch and Bound for the following knapsack problem: n=5 profits=(10, 15, 6, 8, 4) and corresponding weights=(4, 6, 3, 4, 2) and m=12. Solution with state space tree------- 8 Marks Find the profit of the knapsack bag fill with fraction (upper bound value) and without fraction (lower bound value) at each node of the state space tree. 8. b) Explain the principles of Control Abstractions for LC- search. For speeding up the search process here need to intelligent ranking function for live nodes. Each time, the next E-node is selected on the basis of this ranking function. For this ranking function additional computation (normally cost) is needed to reach the answer node from the live node. LC-search is a kind of search in which least cost involved for reaching to answer node. At each E-node the probability of being an answer node is checked. BFS and D-search are special cases of LC search. An LC search with bounding functions in known as LC Branch and Bound search. The applications of LC Branch and Bound are 0/1 Knapsack problem and Travelling salesman problem. The search mainly based on the state space tree. To find upper bound value and lower bound value at the each node to get the ranking value to identify which node is least cost. ---------4 Marks 9. a) Find an optimal solution for a travelling sales person problem using branch & bound technique by choosing an example. To get the solution for the TSP have to follow:-----3 Marks Step1: Find out the reduced cost matrix from a given cost matrix. This can be obtained as follows: 1. Row reduction: Get minimum element from the each row and subtract with each element include which element get, do it all rows in the cost matrix. After applying subtraction add all of the minimum elements, then gets row wise reduction sum.

2. Column reduction: As like row reduction get minimum element from each column and subtract to each element and do it all columns. Add all of the elements, then gets column wise reduction sum. Cumulative Reduction Sum (r) = row wise reduction sum + column wise reduction sum Step2: For starting node, cumulative reduction sum is as lower bound value and is upper bound value a) If path of i, j is considered then change all entries in row I and column j of matrix A to. b) Set A(j, 1) to.(assume starting node as 1) c) Apply row reduction and column reduction except for rows and columns containing, and find cumulative reduction sum (r). And find the lower bound value with Ĉ(S)= Ĉ(R) + A(i, j) + r Here Ĉ(R) is indicates lower bound of i th node in (i, j) path Ĉ(S) is indicates lower bound of jth node in (i, j) path r is cumulative reduction sum of the cost matrix in the (i, j) path. Example-----5 Marks 9. b) Explain the principles of FIFO Branch and Bound. FIFO stands or First In First Out, is follows the BFS technique. As like BFS, In this FIFO Branch and Bound reach a node to find upper bound and lower bound values and next it reaches another node in the same level of state space tree. And next reaches the node which is presented in the queue. FIFO Branch and Bound applications are knapsack problem and travelling salesman problem. This FIFO is one of the techniques of LC search. When implementing a FIFO branch and bound algorithm, here reach each and every node in the state space tree. Here can find out more than one solution for the problem, if the problem has the multiple paths of solution. Unlike LCBB, The FIFO BB needs more memory to show each node in the state space tree. The main principle of the FIFO is reaching every node which is generated by solution process in the state space tree. -------------4 Marks Scheme prepared by Signature of the HOD, IT Dept. Paper Evaluators: S.No Name Of the College Name of the Faculty Signature