PSD1A. DESIGN AND ANALYSIS OF ALGORITHMS Unit : I-V
|
|
- Ferdinand Phelps
- 5 years ago
- Views:
Transcription
1 PSD1A DESIGN AND ANALYSIS OF ALGORITHMS Unit : I-V
2 UNIT I -- Introduction -- Definition of Algorithm -- Pseudocode conventions -- Recursive algorithms -- Time and space complexity -- Big- o notation -- Practical complexities -- Randomized algorithms -- Repeated element & rimality testing -- Divide and Conquer: General Method -- Finding maximum and minimum -- Merge sort. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 2
3 Algorithm Algorithm is a finite set of instructions that, if followed, accomplishes a particular task. (OR) An algorithm is a sequence of unambiguous instructions for solving a problem, i.e., for obtaining a required output for any legitimate input in a finite amount of time. Criteria for Algorithm Input Output Definiteness Finiteness Effectiveness PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 3
4 PSEUDOCODE TM Algorithm can be described in many ways like English for specifying algorithm in step by step Flowchart for graphical representation. But these two ways work well only if algorithm is small or simple. For large or big algorithm we have to use pseudo code. Pseudo code is a kind of structured English for describing algorithms. It allows the designer to focus on the logic of the algorithm without being distracted by details of language syntax. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 4
5 Recursive Algorithms A function is called itself then it called recursive function. Similarly an algorithm is said to be recursive if the same algorithm is invoked in the body. Two types of Recursive algorithms. 1) Direct recursive algorithm An algorithm that calls itself is direct recursive. 2) Indirect recursive algorithm An algorithm, if it calls another algorithm is indirect recursive. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 5
6 Towers of Hanoi Problem Tower A, B, and C are diamond towers. Tower A has 64 golden disks. The disks were of decreasing size and where stacked on the towers in decreasing order of size bottom to top. Brahma priests have been attempting to move the disk from tower A to Tower B by using Tower C for intermediate storage. A very elegant solution for this towers of Hanoi by using Recursion. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 6
7 Space Complexity The space complexity of an algorithm is the amount of memory it needs to run to completion. The space needed by algorithm is the sum of following components A fixed part that is independent of the characteristics of input and output. Example Number & size of Input & Output. This includes instruction space [space for code] + Space for simple variables + Fixed-size component variables + Space for constant and so on. A variable part that consists of the space needed by component variables whose size is dependent on the particular problem instance being solved + the space needed by referenced variables + Recursion stack space. The space requirement S(P) of any algorithm P can be written as S(P)=C+ S P Where C Constant, S P Instance characteristics. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 7
8 Time complexity T(P) Time complexity of an algorithm is the amount of computer time it needs to run to completion. Here RUN means Compile + Execution. Time Complexity : T(P)=t c +t p But we are neglecting t c Because the compile time does not depends on the instance characteristics. The compiled program will be run several times without recompilation. So T(P)= t p Here t p instance characteristics. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 8
9 Big - Oh Notation (O) Consider the following graph drawn for the values of f(n) and C g(n) for input (n) value on X-Axis and time required is on Y-Axis In above graph after a particular input value n 0, always C g(n) is greater than f(n) which indicates the algorithm's upper bound. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 9
10 Big - Theta Notation (Θ) Consider the following graph drawn for the values of f(n) and C g(n) for input (n) value on X-Axis and time required is on Y-Axis In above graph after a particular input value n 0, always C 1 g(n) is less than f(n) and C 2 g(n) is greater than f(n) which indicates the algorithm's average bound. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 10
11 Big - Omega Notation (Ω) Consider the following graph drawn for the values of f(n) and C g(n) for input (n) value on X-Axis and time required is on Y-Axis In above graph after a particular input value n 0, always C x g(n) is less than f(n) which indicates the algorithm's lower bound. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 11
12 Randomized Algorithms A randomized algorithm is one that makes use of randomizer. Ex. Random number generator. Decisions made by the algorithm depends on the output of the randomizer. The execution time of a randomized algorithm could also vary from run to run for the same input. Randomized algorithms are of two classes. Las Vegas Algorithms Monte Carlo Algorithms Las Vegas Algorithms Algorithms that produce the same output for the same input. Monte Carlo Algorithms Algorithms whose outputs might differ from run to run for the same input. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 12
13 Diagrammatic Representation of Divide & Conquer Problem of size N Subprogram of size N/2 Subprogram of size N/2 Solution to subprogram 1 Solution to subprogram 2 Solution to the original problem of size n PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 13
14 Finding Max & Min using Divide and Conquer PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 14
15 Finding Max & Min using Divide and Conquer Blocks received after Recursive Algorithm Finding max and min PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 15
16 Video Link- PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 16
17 UNIT II -- Divide and conquer -- Quick Sort -- Selection Sort -- Strassen's matrix multiplication -- Greedy Method -- knapsack Problem -- Tree vertex splitting -- Job sequencing with dead lines -- Optimal storage on tapes. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 17
18 Quick Sort Video Link: PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 18
19 Average-Case Analysis PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 19
20 Selection Sort PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 20
21 Divide and Conquer Matrix Multiply A B = R A 0 A 1 A 2 A 3 B 0 B 1 = B 2 B 3 A 0 B 0 +A 1 B 2 A 0 B 1 +A 1 B 3 A 2 B 0 +A 3 B 2 A 2 B 1 +A 3 B 3 Divide matrices into sub-matrices: A 0, A 1, A 2 etc Use blocked matrix multiply equations Recursively multiply sub-matrices PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 21
22 PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 22
23 A Greedy Method Problem: Pick k numbers out of n numbers such that the sum of these k numbers is the largest. Suppose that a problem can be solved by a sequence of decisions. The greedy method has that each decision is locally optimal. These locally optimal solutions will finally add up to a globally optimal solution. Algorithm: FOR i = 1 to k pick out the largest number and delete this number from the input. ENDFOR Video Link : PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 23
24 The knapsack problem The greedy algorithm: Step 1: Sort p i /w i into nonincreasing order. Step 2: Put the objects into the knapsack according to the sorted sequence as possible as we can. Example n = 3, M = 20, (p 1, p 2, p 3 ) = (25, 24, 15) (w 1, w 2, w 3 ) = (18, 15, 10) Sol: p 1 /w 1 = 25/18 = 1.39 p 2 /w 2 = 24/15 = 1.6 p 3 /w 3 = 15/10 = 1.5 Optimal solution: x 1 =0,x 2 =1,x 3 = 1/2 PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 24
25 Job Sequencing with Deadlines Problem: n jobs, S={1, 2,, n}, each job i has a deadline d i 0 and a profit p i 0. We need one unit of time to process each job and we can do at most one job each time. We can earn the profit p i if job i is completed by its deadline. i p i d i The optimal solution = {1, 2, 4}. The total profit = = 40. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 25
26 Job Sequencing with Deadlines PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 26
27 Optimal Storage on Tapes The problem: Given n programs to be stored on tape, the lengths of these n programs are l 1, l 2,..., l n respectively. Suppose the programs are stored in the order of i 1, i 2,..., i n Let t j be the time to retrieve program i j. Assume that the tape is initially positioned at the beginning. t j is proportional to the sum of all lengths of programs stored in front of the program i j. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 27
28 The goal is to minimize MRT (Mean Retrieval Time), Ex: 1 n j 1 i.e. want to minimize n 3, ( l1, l2, l3) (5,10,3) n t j n j l ik j 1 k 1 There are n! = 6 possible orderings for storing them. order total retrieval time MRT (5+10)+(5+10+3)=38 5+(5+3)+(5+3+10)=31 10+(10+5)+(10+5+3)=43 10+(10+3)+(10+3+5)=41 3+(3+5)+(3+5+10)=29 3+(3+10)+(3+10+5)=34 38/3 31/3 43/3 41/3 29/3 34/3 Smallest PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 28
29 UNIT III -- Dynamic Programming -- Multistage graphs -- All pairs shortest paths -- Single source shortest paths -- String Editing -- 0/1 knapsack -- Search techniques for graphs DFS & BFS -- Connected components -- Biconnected components. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 29
30 Dynamic Programming Dynamic Programming is an algorithm design technique for optimization problems: often minimizing or maximizing. Like divide and conquer, DP solves problems by combining solutions to sub problems. Unlike divide and conquer, sub problems are not independent. Sub problems may share sub-sub problems, However, solution to one sub problem may not affect the solutions to other sub problems of the same problem. DP reduces computation by Solving sub problems in a bottom-up fashion. Storing solution to a sub problem the first time it is solved. Looking up the solution when sub problem is encountered again. Comp 122, Spring 2004 PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 30
31 Steps in Dynamic Programming 1. Characterize structure of an optimal solution. 2. Define value of optimal solution recursively. 3. Compute optimal solution values either top-down with caching or bottomup in a table. 4. Construct an optimal solution from computed values. Overlapping Sub problems The space of sub problems must be small. The total number of distinct sub problems is a polynomial in the input size. A recursive algorithm is exponential because it solves the same problems repeatedly. If divide-and-conquer is applicable, then each problem solved will be brand new. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 31
32 All-Pairs Shortest Paths A A (b) A -1 (c) A 0 A A (d) A 1 (e) A 2 PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 32
33 Shortest paths on a special graph Problem: Find a shortest path from v 0 to v 3. The greedy method can solve this problem. The shortest path: = 7. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 33
34 Shortest paths on a Multi-stage Graph Problem: Find a shortest path from v 0 to v 3 in the multi-stage graph. Greedy method: v 0 v 1,2 v 2,1 v 3 = 23 Optimal: v 0 v 1,1 v 2,2 v 3 = 7 The greedy method does not work. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 34
35 Multi-stage Graph Problem Solution d min (i,j): minimum distance between i and j. d min (v 0,v 3 )=min 3+d min (v 1,1,v 3 ) 1+d min (v 1,2,v 3 ) 5+d min (v 1,3,v 3 ) 7+d min (v 1,4,v 3 ) This problem can be solved by the dynamic programming method. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 35
36 Minimum spanning trees (MST) It may be defined on Euclidean space points or on a graph. G = (V, E): weighted connected undirected graph Spanning tree : S = (V, T), T E, undirected tree Minimum spanning tree(mst) : a spanning tree with the smallest total weight. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 36
37 An example of MST A graph and one of its minimum costs spanning tree PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 37
38 Single-Source Shortest Path Problem shortest paths from v 0 to all destinations PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 38
39 Dijkstra s algorithm In the cost adjacency matrix, all entries not shown are +. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 39
40 Vertex Iteration S Selected (1) (2) (3) (4) (5) (6) (7) (8) Initial , ,6, ,6,7, ,6,7,4, ,6,7,4,8, ,6,7,4,8,3, Time complexity : O(n 2 ), n = V. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 40
41 Adjacency-Matrix Representation I D A B C D E F G A B C E F G A B C D E F G -- One simple way of representing a graph is the adjacency matrix -- A 2-D array has a mark at [i][j] if there is an edge from node i to node j -- The adjacency matrix is symmetric about the main diagonal -- This representation is only suitable for small graphs PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 41
42 Adjacency Matrix Representation II D A B C D E F G A G E B F C A B C D E F G An adjacency matrix can equally well be used for digraphs (directed graphs) A 2-D array has a mark at [i][j] if there is an edge from node i to node j. 42 PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 42
43 Edge-Set Representation s D t w A G p u E B r v F q C NodeSet = {A, B, C, D, E, F, G} EdgeSet = { p: (A, E), q: (B, C), r: (E, B), s: (D, D), t: (D, A), u: (E, G), v: (F, E), w: (G, D) } Here we have a set of nodes, and each node contains only its element. Each edge contains references to its source and its destination. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 43
44 Adjacency Set Representation s D t w A G p u E B r v F q C A { p } B { q } C { } D { s, t } p: (A, E) q: (B, C) r: (E, B) s: (D, D) E { r, u } t: (D, A) F { v } u: (E, G) G { w } v: (F, E) w: (G, D) Here we have a set of nodes, and each node refers to a set of edges. Each edge contains references to its source and its destination. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 44
45 Depth-First Search 0,1,3,7,4,5,2, HeadNodes [0] [1] [2] [3] [4] [5] [6] [7] PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 45
46 PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 46
47 Breadth-First Search 0,1,2,3,4,5,6, HeadNodes [0] [1] [2] [3] [4] [5] [6] [7] PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 47
48 Breadth-First Search PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 48
49 Graphs: Connected Components H 1 0 H G PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 49
50 Biconnected Components (a) A connected graph 1,3,5,7 is articulation point (b) Its biconnected components PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 50
51 UNIT IV -- Back Tracking -- 8-queens -- Sum of subsets -- Graph Coloring -- Hamiltonian cycles -- Branch and Bound -- Traveling Salesperson problem PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 51
52 Backtracking Suppose you have to make a series of decisions, among various choices, where You don t have enough information to know what to choose Each decision leads to a new set of choices Some sequence of choices (possibly more than one) may be a solution to your problem Backtracking is a methodical way of trying out various sequences of decisions, until you find one that works 52 PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 52
53 Coloring a Map You wish to color a map with not more than four colors red, yellow, green, blue Adjacent countries must be in different colors You don t have enough information to choose colors Each choice leads to another set of choices One or more sequences of choices may (or may not) lead to a solution Many coloring problems can be solved with backtracking PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 53
54 Solving a puzzle In this puzzle, all holes but one are filled with white pegs You can jump over one peg with another Jumped pegs are removed The object is to remove all but the last peg You don t have enough information to jump correctly Each choice leads to another set of choices One or more sequences of choices may (or may not) lead to a solution Many kinds of puzzle can be solved with backtracking PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 54
55 Backtracking (Animation) dead end? dead end dead end start??? dead end dead end? success! PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 55
56 Terminology I A tree is composed of nodes There are three kinds of nodes: The (one) root node Internal nodes Leaf nodes Backtracking can be thought of as searching a tree for a particular goal leaf node PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 56
57 Terminology II Each non-leaf node in a tree is a parent of one or more other nodes (its children) Each node in the tree, other than the root, has exactly one parent parent Usually, however, we draw our trees downward, with the root at the top parent children children PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 57
58 Backtracking Eight Queens Problem Find an arrangement of 8 queens on a single chess board such that no two queens are attacking one another. In chess, queens can move all the way down any row, column or diagonal (so long as no pieces are in the way). Due to the first two restrictions, it's clear that each row and column of the board will have exactly one queen. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 58
59 Backtracking Eight Queens Problem The backtracking strategy is as follows: 1) Place a queen on the first available square in row 1. 2) Move onto the next row, placing a queen on the first available square there (that doesn't conflict with the previously placed queens). 3) Continue in this fashion until either: a) you have solved the problem, or b) you get stuck. When you get stuck, remove the queens that got you there, until you get to a row where there is another valid square to try. Q Q Q Q Q Continue Q Video Link htdamen/eight.htm#up PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 59
60 Sum of Subsets State Space Tree for Three items PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 60
61 Hamiltonian Cycle Icosian Game: Invented by Sir. William Rowan Hamilton ( ) in 1857 and sold to a London game dealer in 1859 for 25 pounds. Game Description: The corners of a regular dodecahedron are labeled with the names of cities; the task is to find a circular tour along the edges of the dodecahedron visiting each city exactly once. Solution Model: Hamiltonian cycle; i.e. look for a cycle in the corresponding dodecahedral graph which contains each vertex exactly once. The Platonic Solid used in Icosian game; the corresponding Hamiltonian cycle is designated by darkened edges. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 61
62 Hamiltonian Cycle Hamiltonian Cycle: If G = (V, E) is a graph or multi-graph with V >=3, we say that G has a Hamiltonian cycle if there is a cycle in G that contains every vertex in V. Hamiltonian Path A Hamiltonian path is a path (and not a cycle) in G that contains each vertex. It is possible, however, for a graph to have a Hamiltonian path without having a Hamiltonian cycle. There is no helpful connection between the idea of Eulerian circuits (or trails) and Hamiltonian cycles (or paths). Hamiltonian path Hamiltonian cycle There do not exist conditions on a graph G that guarantee the existence of a Hamiltonian cycle (path). PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 62
63 A Connected Graph with No Cycle of Odd length Does G contain a Hamiltonian path? Starting from vertex a, alternatively label each vertex and its adjacent with x s and y s. If G is to have a Hamiltonian path, there must be an alternating sequence of five x's and five y's. A graph G = (V, E) is bipartite iff it contains no cycle of odd length. G (no cycle of odd length) G is, in fact, a bipartite graph PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 63
64 Branch and Bound PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 64
65 Traveling salesman problem Input: Graph (V,E) Problem: Shortest tour visiting all nodes. Closed loop: B C A D E F G H Optimal = A-B-C-F-H-E-D-G-A Length = 22 Open loop: B C A D E F G H Optimal = D-G-A-B-C-F-H-E Length = 17 PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 65
66 Brute force TSP Brute force: search full tree O(N!) PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 66
67 UNIT V: -- Lower Bound Theory: -- Comparison trees -- Oracles and advisory arguments -- Lower bounds through reduction -- Basic Concepts of NP-Hard and NP-Complete problems. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 67
68 Polynomial Reductions Problem P is reducible to Q -- P <= p Q -- Transforming inputs of P -- To inputs of Q Reducibility relation is transitive PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 68
69 Decision Trees A convenient model of algorithms involving comparisons in which: internal nodes represent comparisons leaves represent outcomes PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 69
70 Lower Bound Through Reduction Lower bound: an estimate on a minimum amount of work needed to solve a given problem Lower bound can be an exact count an efficiency class ( ) Tight lower bound: there exists an algorithm with the same efficiency as the lower bound PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 70
71 Oracle & Adversary Arguments Adversary argument: a method of proving a lower bound by playing role of adversary that makes algorithm work the hardest by adjusting input Example: Guessing a number between 1 and n with yes/no questions Adversary: Puts the number in a larger of the two subsets generated by last question PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 71
72 P, NP, NP-complete, and NP-hard Problems Decision and Optimization problems Decidable, semi-decidable and undecidable problems Class P, NP, NP-complete and NP-hard problems Optimization problem: Find a solution that maximizes or minimizes some objective function Decision problem: A question that has two possible answers yes or no. The question is about some input. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 72
73 P, NP, NP-complete, and NPhard Problems PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 73
74 NP Complete Problem PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 74
75 Decidability of Decision Problems A problem is decidable if there is an algorithm that says yes if the answer is yes, and no otherwise A problem is semi-decidable if there is an algorithm that says yes if the answer is yes, however it may loop infinitely if the answer is no. A problem is undecidable if we can prove that there is no algorithm that will deliver an answer. PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 75
76 Class P & Class NP P: the class of decision problems that are solvable in O(p(n)) time, where p(n) is a polynomial of problem s input size n. Problems in this class are called tractable Examples: searching graph connectivity NP (nondeterministic polynomial): Class of decision problems whose proposed solutions can be verified in polynomial time = solvable by a nondeterministic polynomial algorithm. Problems in this class are called intractable PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 76
77 Non Deterministic Polynomial Algorithm PSD1A DESIGN AND ANALYSIS OF ALGORITHMS 77
Sankalchand Patel College of Engineering - Visnagar Department of Computer Engineering and Information Technology. Assignment
Class: V - CE Sankalchand Patel College of Engineering - Visnagar Department of Computer Engineering and Information Technology Sub: Design and Analysis of Algorithms Analysis of Algorithm: Assignment
More informationIV/IV B.Tech (Regular) DEGREE EXAMINATION. Design and Analysis of Algorithms (CS/IT 414) Scheme of Evaluation
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
More informationD.K.M.COLLEGE FOR WOMEN (AUTONOMOUS), VELLORE-1.
D.K.M.COLLEGE FOR WOMEN (AUTONOMOUS), VELLORE-1. DESIGN AND ANALYSIS OF ALGORITHM UNIT- I SECTION-A 2 MARKS 1. Define an algorithm? 2. Specify the criteria of algorithm? 3. What is Computational Procedure?
More informationDepartment of Computer Applications. MCA 312: Design and Analysis of Algorithms. [Part I : Medium Answer Type Questions] UNIT I
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
More informationDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS QUESTION BANK Module 1 OBJECTIVE: Algorithms play the central role in both the science and the practice of computing. There are compelling reasons to study algorithms.
More informationContents. 1 Introduction. 2 Searching and Traversal Techniques. Preface... (vii) Acknowledgements... (ix)
Contents Preface... (vii) Acknowledgements... (ix) 1 Introduction 1.1 Algorithm 1 1.2 Life Cycle of Design and Analysis of Algorithm 2 1.3 Pseudo-Code for Expressing Algorithms 5 1.4 Recursive Algorithms
More informationL.J. Institute of Engineering & Technology Semester: VIII (2016)
Subject Name: Design & Analysis of Algorithm Subject Code:1810 Faculties: Mitesh Thakkar Sr. UNIT-1 Basics of Algorithms and Mathematics No 1 What is an algorithm? What do you mean by correct algorithm?
More informationINSTITUTE OF AERONAUTICAL ENGINEERING
INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad -500 043 INFORMATION TECHNOLOGY TUTORIAL QUESTION BANK Course Name : DESIGN AND ANALYSIS OF ALGORITHMS Course Code : AIT001 Class
More informationCLASS: II YEAR / IV SEMESTER CSE CS 6402-DESIGN AND ANALYSIS OF ALGORITHM UNIT I INTRODUCTION
CLASS: II YEAR / IV SEMESTER CSE CS 6402-DESIGN AND ANALYSIS OF ALGORITHM UNIT I INTRODUCTION 1. What is performance measurement? 2. What is an algorithm? 3. How the algorithm is good? 4. What are the
More information5105 BHARATHIDASAN ENGINEERING COLLEGE
CS 6402 DESIGN AND ANALYSIS OF ALGORITHMS II CSE/IT /IV SEMESTER UNIT I PART A 1. Design an algorithm to compute the area and circumference of a circle?(dec 2016) 2. Define recurrence relation? (Dec 2016)
More informationCS6402 DESIGN AND ANALYSIS OF ALGORITHMS QUESTION BANK UNIT I
CS6402 DESIGN AND ANALYSIS OF ALGORITHMS QUESTION BANK UNIT I PART A(2MARKS) 1. What is an algorithm? 2. What is meant by open hashing? 3. Define Ω-notation 4.Define order of an algorithm. 5. Define O-notation
More informationLecture 3. Brute Force
Lecture 3 Brute Force 1 Lecture Contents 1. Selection Sort and Bubble Sort 2. Sequential Search and Brute-Force String Matching 3. Closest-Pair and Convex-Hull Problems by Brute Force 4. Exhaustive Search
More informationCoping with the Limitations of Algorithm Power Exact Solution Strategies Backtracking Backtracking : A Scenario
Coping with the Limitations of Algorithm Power Tackling Difficult Combinatorial Problems There are two principal approaches to tackling difficult combinatorial problems (NP-hard problems): Use a strategy
More informationChapter 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 information11/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 informationAlgorithm Design Techniques. Hwansoo Han
Algorithm Design Techniques Hwansoo Han Algorithm Design General techniques to yield effective algorithms Divide-and-Conquer Dynamic programming Greedy techniques Backtracking Local search 2 Divide-and-Conquer
More informationLecture 13. Reading: Weiss, Ch. 9, Ch 8 CSE 100, UCSD: LEC 13. Page 1 of 29
Lecture 13 Connectedness in graphs Spanning trees in graphs Finding a minimal spanning tree Time costs of graph problems and NP-completeness Finding a minimal spanning tree: Prim s and Kruskal s algorithms
More informationChapter 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 information2. (a) Explain when the Quick sort is preferred to merge sort and vice-versa.
Code No: RR210504 Set No. 1 1. (a) Order the following functions according to their order of growth (from the lowest to the highest). (n-2)!, 5 log (n+100) 10,2 2n, 0.001n 4 +3n 3 +1, ln 2 n, n 1/3, 3
More informationCS-6402 DESIGN AND ANALYSIS OF ALGORITHMS
CS-6402 DESIGN AND ANALYSIS OF ALGORITHMS 2 marks UNIT-I 1. Define Algorithm. An algorithm is a sequence of unambiguous instructions for solving a problem in a finite amount of time. 2.Write a short note
More informationModule 6 NP-Complete Problems and Heuristics
Module 6 NP-Complete Problems and Heuristics Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS 39217 E-mail: natarajan.meghanathan@jsums.edu P, NP-Problems Class
More informationChapter 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 informationCSCE 350: Chin-Tser Huang. University of South Carolina
CSCE 350: Data Structures and Algorithms Chin-Tser Huang huangct@cse.sc.edu University of South Carolina Announcement Homework 2 will be returned on Thursday; solution will be available on class website
More informationCS6402 Design and Analysis of Algorithm. 2 Marks Question & Answer UNIT I INTRODUCTION
CS6402 Design and Analysis of Algorithm 2 Marks Question & Answer UNIT I INTRODUCTION 1. What is performance measurement? Performance measurement is concerned with obtaining the space and the time requirements
More informationCSC Design and Analysis of Algorithms. Lecture 4 Brute Force, Exhaustive Search, Graph Traversal Algorithms. Brute-Force Approach
CSC 8301- Design and Analysis of Algorithms Lecture 4 Brute Force, Exhaustive Search, Graph Traversal Algorithms Brute-Force Approach Brute force is a straightforward approach to solving a problem, usually
More informationNotation Index. Probability notation. (there exists) (such that) Fn-4 B n (Bell numbers) CL-27 s t (equivalence relation) GT-5.
Notation Index (there exists) (for all) Fn-4 Fn-4 (such that) Fn-4 B n (Bell numbers) CL-27 s t (equivalence relation) GT-5 ( n ) k (binomial coefficient) CL-15 ( n m 1,m 2,...) (multinomial coefficient)
More informationDESIGN AND ANALYSIS OF ALGORITHMS
QUESTION BANK DESIGN AND ANALYSIS OF ALGORITHMS UNIT1: INTRODUCTION OBJECTIVE: Algorithms play the central role in both the science and the practice of computing. There are compelling reasons to study
More informationFurther Mathematics 2016 Module 2: NETWORKS AND DECISION MATHEMATICS Chapter 9 Undirected Graphs and Networks
Further Mathematics 2016 Module 2: NETWORKS AND DECISION MATHEMATICS Chapter 9 Undirected Graphs and Networks Key knowledge the conventions, terminology, properties and types of graphs; edge, face, loop,
More informationBacktracking and Branch-and-Bound
Backtracking and Branch-and-Bound Usually for problems with high complexity Exhaustive Search is too time consuming Cut down on some search using special methods Idea: Construct partial solutions and extend
More informationGraph definitions. There are two kinds of graphs: directed graphs (sometimes called digraphs) and undirected graphs. An undirected graph
Graphs Graph definitions There are two kinds of graphs: directed graphs (sometimes called digraphs) and undirected graphs start Birmingham 60 Rugby fill pan with water add salt to water take egg from fridge
More informationDEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: CS6402- Design & Analysis of Algorithm Year/Sem : II/IV UNIT-I INTRODUCTION
Chendu College of Engineering & Technology (Approved by AICTE, New Delhi and Affiliated to Anna University) Zamin Endathur, Madurantakam, Kancheepuram District 603311 +91-44-27540091/92 www.ccet.org.in
More informationCS6402-DESIGN AND ANALYSIS OF ALGORITHM. TWO MARK QUESTION WITH ANSWERS Unit-I. Introduction
CS6402-DESIGN AND ANALYSIS OF ALGORITHM TWO MARK QUESTION WITH ANSWERS Unit-I Introduction Why is the need of studying algorithms? From a practical standpoint, a standard set of algorithms from different
More informationCS 440 Theory of Algorithms /
CS 440 Theory of Algorithms / CS 468 Algorithms in Bioinformaticsi Brute Force. Design and Analysis of Algorithms - Chapter 3 3-0 Brute Force A straightforward approach usually based on problem statement
More informationCSE 417 Branch & Bound (pt 4) Branch & Bound
CSE 417 Branch & Bound (pt 4) Branch & Bound Reminders > HW8 due today > HW9 will be posted tomorrow start early program will be slow, so debugging will be slow... Review of previous lectures > Complexity
More informationUnit-5 Dynamic Programming 2016
5 Dynamic programming Overview, Applications - shortest path in graph, matrix multiplication, travelling salesman problem, Fibonacci Series. 20% 12 Origin: Richard Bellman, 1957 Programming referred to
More informationModule 6 P, NP, NP-Complete Problems and Approximation Algorithms
Module 6 P, NP, NP-Complete Problems and Approximation Algorithms Dr. Natarajan Meghanathan Associate Professor of Computer Science Jackson State University Jackson, MS 39217 E-mail: natarajan.meghanathan@jsums.edu
More informationModule 2: NETWORKS AND DECISION MATHEMATICS
Further Mathematics 2017 Module 2: NETWORKS AND DECISION MATHEMATICS Chapter 9 Undirected Graphs and Networks Key knowledge the conventions, terminology, properties and types of graphs; edge, face, loop,
More informationUNIT 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 informationChapter-6 Backtracking
Chapter-6 Backtracking 6.1 Background Suppose, if you have to make a series of decisions, among various choices, where you don t have enough information to know what to choose. Each decision leads to a
More informationCS521 \ 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 informationNotation Index 9 (there exists) Fn-4 8 (for all) Fn-4 3 (such that) Fn-4 B n (Bell numbers) CL-25 s ο t (equivalence relation) GT-4 n k (binomial coef
Notation 9 (there exists) Fn-4 8 (for all) Fn-4 3 (such that) Fn-4 B n (Bell numbers) CL-25 s ο t (equivalence relation) GT-4 n k (binomial coefficient) CL-14 (multinomial coefficient) CL-18 n m 1 ;m 2
More informationSeach algorithms The travelling salesman problem The Towers of Hanoi Playing games. Comp24412: Symbolic AI. Lecture 4: Search. Ian Pratt-Hartmann
Comp24412: Symbolic AI Lecture 4: Search Ian Pratt-Hartmann Room KB2.38: email: ipratt@cs.man.ac.uk 2016 17 Outline Seach algorithms The travelling salesman problem The Towers of Hanoi Playing games Typical
More informationGraphs and trees come up everywhere. We can view the internet as a graph (in many ways) Web search views web pages as a graph
Graphs and Trees Graphs and trees come up everywhere. We can view the internet as a graph (in many ways) who is connected to whom Web search views web pages as a graph Who points to whom Niche graphs (Ecology):
More informationModule 5 Graph Algorithms
Module 5 Graph lgorithms Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS 97 E-mail: natarajan.meghanathan@jsums.edu 5. Graph Traversal lgorithms Depth First
More informationComputer Science and Software Engineering University of Wisconsin - Platteville. 3. Search (Part 1) CS 3030 Lecture Notes Yan Shi UW-Platteville
Computer Science and Software Engineering University of Wisconsin - Platteville 3. Search (Part 1) CS 3030 Lecture Notes Yan Shi UW-Platteville Read: Textbook Chapter 3.7-3.9,3.12, 4. Problem Solving as
More informationReference Sheet for CO142.2 Discrete Mathematics II
Reference Sheet for CO14. Discrete Mathematics II Spring 017 1 Graphs Defintions 1. Graph: set of N nodes and A arcs such that each a A is associated with an unordered pair of nodes.. Simple graph: no
More informationAlgorithm Design Techniques (III)
Algorithm Design Techniques (III) Minimax. Alpha-Beta Pruning. Search Tree Strategies (backtracking revisited, branch and bound). Local Search. DSA - lecture 10 - T.U.Cluj-Napoca - M. Joldos 1 Tic-Tac-Toe
More information15CS43: DESIGN AND ANALYSIS OF ALGORITHMS
15CS43: DESIGN AND ANALYSIS OF ALGORITHMS QUESTION BANK MODULE1 1. What is an algorithm? Write step by step procedure to write an algorithm. 2. What are the properties of an algorithm? Explain with an
More informationAssignment No 2 (Group B)
Assignment No 2 (Group B) 1 Problem Statement : Concurrent Implementation of Travelling Salesman Problem. 2 Objective : To develop problem solving abilities using Mathematical Modeling. To apply algorithmic
More informationCSC 8301 Design and Analysis of Algorithms: Exhaustive Search
CSC 8301 Design and Analysis of Algorithms: Exhaustive Search Professor Henry Carter Fall 2016 Recap Brute force is the use of iterative checking or solving a problem by its definition The straightforward
More informationR13 SET - 1. ''' '' ''' ' blog: anilkumarprathipati.wordpress.com. Code No: RT32054
R13 SET - 1 III B. Tech II Semester Regular Examinations, April - 2016 1 a) Distinguish between Algorithm and Psuedocode. [3M] b) Describe the Algorithm Analysis of Binary Search. [4M] c) State the Job
More informationCSCE 321/3201 Analysis and Design of Algorithms. Prof. Amr Goneid. Fall 2016
CSCE 321/3201 Analysis and Design of Algorithms Prof. Amr Goneid Fall 2016 CSCE 321/3201 Analysis and Design of Algorithms Prof. Amr Goneid Course Resources Instructor: Prof. Amr Goneid E-mail: goneid@aucegypt.edu
More informationBrute Force: Selection Sort
Brute Force: Intro Brute force means straightforward approach Usually based directly on problem s specs Force refers to computational power Usually not as efficient as elegant solutions Advantages: Applicable
More informationLecture 3, Review of Algorithms. What is Algorithm?
BINF 336, Introduction to Computational Biology Lecture 3, Review of Algorithms Young-Rae Cho Associate Professor Department of Computer Science Baylor University What is Algorithm? Definition A process
More informationElements of Graph Theory
Elements of Graph Theory Quick review of Chapters 9.1 9.5, 9.7 (studied in Mt1348/2008) = all basic concepts must be known New topics we will mostly skip shortest paths (Chapter 9.6), as that was covered
More information6. Algorithm Design Techniques
6. Algorithm Design Techniques 6. Algorithm Design Techniques 6.1 Greedy algorithms 6.2 Divide and conquer 6.3 Dynamic Programming 6.4 Randomized Algorithms 6.5 Backtracking Algorithms Malek Mouhoub, CS340
More informationUNIT 3. Greedy Method. Design and Analysis of Algorithms GENERAL METHOD
UNIT 3 Greedy Method GENERAL METHOD Greedy is the most straight forward design technique. Most of the problems have n inputs and require us to obtain a subset that satisfies some constraints. Any subset
More informationPATH FINDING AND GRAPH TRAVERSAL
GRAPH TRAVERSAL PATH FINDING AND GRAPH TRAVERSAL Path finding refers to determining the shortest path between two vertices in a graph. We discussed the Floyd Warshall algorithm previously, but you may
More informationIntroduction to Graph Theory
Introduction to Graph Theory Tandy Warnow January 20, 2017 Graphs Tandy Warnow Graphs A graph G = (V, E) is an object that contains a vertex set V and an edge set E. We also write V (G) to denote the vertex
More information8 NP-complete problem Hard problems: demo
Ch8 NPC Millennium Prize Problems http://en.wikipedia.org/wiki/millennium_prize_problems 8 NP-complete problem Hard problems: demo NP-hard (Non-deterministic Polynomial-time hard), in computational complexity
More informationSearch 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.
UNIT 3 BASIC TRAVERSAL AND SEARCH TECHNIQUES 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. Search involves
More informationModule 6 NP-Complete Problems and Heuristics
Module 6 NP-Complete Problems and Heuristics Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS 397 E-mail: natarajan.meghanathan@jsums.edu Optimization vs. Decision
More informationTOTAL CREDIT UNITS L T P/ S SW/F W. Course Title: Analysis & Design of Algorithm. Course Level: UG Course Code: CSE303 Credit Units: 5
Course Title: Analysis & Design of Algorithm Course Level: UG Course Code: CSE303 Credit Units: 5 L T P/ S SW/F W TOTAL CREDIT UNITS 3 1 2-5 Course Objectives: The designing of algorithm is an important
More informationOutline. Graphs. Divide and Conquer.
GRAPHS COMP 321 McGill University These slides are mainly compiled from the following resources. - Professor Jaehyun Park slides CS 97SI - Top-coder tutorials. - Programming Challenges books. Outline Graphs.
More informationGraph Theory: Starting Out
Graph Theory: Starting Out Administrivia To read: Chapter 7, Sections 1-3 (Ensley/Crawley) Problem Set 5 sent out; due Monday 12/8 in class. There will be two review days next week (Wednesday and Friday)
More informationTheorem 2.9: nearest addition algorithm
There are severe limits on our ability to compute near-optimal tours It is NP-complete to decide whether a given undirected =(,)has a Hamiltonian cycle An approximation algorithm for the TSP can be used
More informationModule 6 NP-Complete Problems and Heuristics
Module 6 NP-Complete Problems and Heuristics Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS 97 E-mail: natarajan.meghanathan@jsums.edu Optimization vs. Decision
More informationINTRODUCTION TO ALGORITHMS
UNIT- Introduction: Algorithm: The word algorithm came from the name of a Persian mathematician Abu Jafar Mohammed Ibn Musa Al Khowarizmi (ninth century) An algorithm is simply s set of rules used to perform
More informationCSE 100: B+ TREE, 2-3 TREE, NP- COMPLETNESS
CSE 100: B+ TREE, 2-3 TREE, NP- COMPLETNESS Analyzing find in B-trees Since the B-tree is perfectly height-balanced, the worst case time cost for find is O(logN) Best case: If every internal node is completely
More informationQuestions? You are given the complete graph of Facebook. What questions would you ask? (What questions could we hope to answer?)
P vs. NP What now? Attribution These slides were prepared for the New Jersey Governor s School course The Math Behind the Machine taught in the summer of 2011 by Grant Schoenebeck Large parts of these
More information17/05/2018. Outline. Outline. Divide and Conquer. Control Abstraction for Divide &Conquer. Outline. Module 2: Divide and Conquer
Module 2: Divide and Conquer Divide and Conquer Control Abstraction for Divide &Conquer 1 Recurrence equation for Divide and Conquer: If the size of problem p is n and the sizes of the k sub problems are
More informationUnit 8: Coping with NP-Completeness. Complexity classes Reducibility and NP-completeness proofs Coping with NP-complete problems. Y.-W.
: Coping with NP-Completeness Course contents: Complexity classes Reducibility and NP-completeness proofs Coping with NP-complete problems Reading: Chapter 34 Chapter 35.1, 35.2 Y.-W. Chang 1 Complexity
More informationIntroduction to Computer Science
Introduction to Computer Science CSCI 109 Readings St. Amant, Ch. 4, Ch. 8 China Tianhe-2 Andrew Goodney Spring 2018 An algorithm (pronounced AL-go-rithum) is a procedure or formula for solving a problem.
More informationApproximation Algorithms
15-251: Great Ideas in Theoretical Computer Science Spring 2019, Lecture 14 March 5, 2019 Approximation Algorithms 1 2 SAT 3SAT Clique Hamiltonian- Cycle given a Boolean formula F, is it satisfiable? same,
More informationEND-TERM EXAMINATION
(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
More informationINDEX. Cambridge University Press How to Think About Algorithms Jeff Edmonds Index More information
INDEX 439 abstract data type (ADT), 1, 43 exercise solutions, 414 functions vs., 43 merging with queue, 56 specifications/implementations, 44 dictionary, 47 graphs, 47 link list implementation, 51 list,
More informationChapter 11: Graphs and Trees. March 23, 2008
Chapter 11: Graphs and Trees March 23, 2008 Outline 1 11.1 Graphs: An Introduction 2 11.2 Paths and Circuits 3 11.3 Matrix Representations of Graphs 4 11.5 Trees Graphs: Basic Definitions Informally, a
More informationGraph Algorithms (part 3 of CSC 282),
Graph Algorithms (part of CSC 8), http://www.cs.rochester.edu/~stefanko/teaching/10cs8 1 Schedule Homework is due Thursday, Oct 1. The QUIZ will be on Tuesday, Oct. 6. List of algorithms covered in the
More informationGRAPHS, GRAPH MODELS, GRAPH TERMINOLOGY, AND SPECIAL TYPES OF GRAPHS
GRAPHS, GRAPH MODELS, GRAPH TERMINOLOGY, AND SPECIAL TYPES OF GRAPHS DR. ANDREW SCHWARTZ, PH.D. 10.1 Graphs and Graph Models (1) A graph G = (V, E) consists of V, a nonempty set of vertices (or nodes)
More information1 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 informationChapter 14. Graphs Pearson Addison-Wesley. All rights reserved 14 A-1
Chapter 14 Graphs 2011 Pearson Addison-Wesley. All rights reserved 14 A-1 Terminology G = {V, E} A graph G consists of two sets A set V of vertices, or nodes A set E of edges A subgraph Consists of a subset
More informationDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK UNIT-III. SUB NAME: DESIGN AND ANALYSIS OF ALGORITHMS SEM/YEAR: III/ II PART A (2 Marks)
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK UNIT-III SUB CODE: CS2251 DEPT: CSE SUB NAME: DESIGN AND ANALYSIS OF ALGORITHMS SEM/YEAR: III/ II PART A (2 Marks) 1. Write any four examples
More informationComputer Science 385 Design and Analysis of Algorithms Siena College Spring Topic Notes: Brute-Force Algorithms
Computer Science 385 Design and Analysis of Algorithms Siena College Spring 2019 Topic Notes: Brute-Force Algorithms Our first category of algorithms are called brute-force algorithms. Levitin defines
More informationExercise 1. D-ary Tree
CSE 101: Design and Analysis of Algorithms Winter 2018 Homework 1 Solutions Due: 01/19/2018, 11.59 PM Exercise 1. D-ary Tree A d-ary tree is a rooted tree in which each node has at most d children. Show
More informationUCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis
UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis Lecture 16 Class URL: http://vlsicad.ucsd.edu/courses/cse21-s14/ Lecture 16 Notes Goals for this week Graph basics Types
More informationCS 231: Algorithmic Problem Solving
CS 231: Algorithmic Problem Solving Naomi Nishimura Module 7 Date of this version: January 28, 2019 WARNING: Drafts of slides are made available prior to lecture for your convenience. After lecture, slides
More informationwww.thestudycampus.com Recursion Recursion is a process for solving problems by subdividing a larger problem into smaller cases of the problem itself and then solving the smaller, more trivial parts. Recursion
More informationThe complement of PATH is in NL
340 The complement of PATH is in NL Let c be the number of nodes in graph G that are reachable from s We assume that c is provided as an input to M Given G, s, t, and c the machine M operates as follows:
More information4. Give the diagram representation of Notion of algorithm. [M 13]
DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CS 6402 DESIGN AND ANALYSIS OF ALGORITHMS UNIT 1: INTRODUCTION PART A (2 marks) 1. What is the need of studying
More informationCSE373: Data Structure & Algorithms Lecture 23: More Sorting and Other Classes of Algorithms. Catie Baker Spring 2015
CSE373: Data Structure & Algorithms Lecture 23: More Sorting and Other Classes of Algorithms Catie Baker Spring 2015 Admin No class on Monday Extra time for homework 5 2 Sorting: The Big Picture Surprising
More informationOverview of Data Structures, Algorithm Analysis
SIDDHARTH GROUP OF INSTITUTIONS :: PUTTUR Siddharth Nagar, Narayanavanam Road 517583 QUESTION BANK (DESCRIPTIVE) Subject with Code : Advanced Data structures and Algorithms (16CS5804) Year & Sem: M.Tech
More informationPractice Problems for the Final
ECE-250 Algorithms and Data Structures (Winter 2012) Practice Problems for the Final Disclaimer: Please do keep in mind that this problem set does not reflect the exact topics or the fractions of each
More informationKonigsberg Bridge Problem
Graphs Konigsberg Bridge Problem c C d g A Kneiphof e D a B b f c A C d e g D a b f B Euler s Graph Degree of a vertex: the number of edges incident to it Euler showed that there is a walk starting at
More informationModel Answer. Section A Q.1 - (20 1=10) B.Tech. (Fifth Semester) Examination Analysis and Design of Algorithm (IT3105N) (Information Technology)
B.Tech. (Fifth Semester) Examination 2013 Analysis and Design of Algorithm (IT3105N) (Information Technology) Model Answer. Section A Q.1 - (20 1=10) 1. Merge Sort uses approach to algorithm design. Ans:
More informationDesign and Analysis of Algorithms
CSE 101, Winter 018 D/Q Greed SP s DP LP, Flow B&B, Backtrack Metaheuristics P, NP Design and Analysis of Algorithms Lecture 8: Greed Class URL: http://vlsicad.ucsd.edu/courses/cse101-w18/ Optimization
More informationThe Algorithm Design Manual
Steven S. Skiena The Algorithm Design Manual With 72 Figures Includes CD-ROM THE ELECTRONIC LIBRARY OF SCIENCE Contents Preface vii I TECHNIQUES 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 2 2.1 2.2 2.3
More information6.2. Paths and Cycles
6.2. PATHS AND CYCLES 85 6.2. Paths and Cycles 6.2.1. Paths. A path from v 0 to v n of length n is a sequence of n+1 vertices (v k ) and n edges (e k ) of the form v 0, e 1, v 1, e 2, v 2,..., e n, v n,
More informationCS270 Combinatorial Algorithms & Data Structures Spring Lecture 19:
CS270 Combinatorial Algorithms & Data Structures Spring 2003 Lecture 19: 4.1.03 Lecturer: Satish Rao Scribes: Kevin Lacker and Bill Kramer Disclaimer: These notes have not been subjected to the usual scrutiny
More informationUNIT 1 BASICS OF AN ALGORITHM
UNIT 1 BASICS OF AN ALGORITHM Basics of an Algorithm Structure Page Nos. 1.0 Introduction 5 1.1 Objectives 6 1.2. Analysis and Complexity of Algorithms 6 1.3 Basic Technique for Design of Efficient Algorithms
More informationFinal. Name: TA: Section Time: Course Login: Person on Left: Person on Right: U.C. Berkeley CS170 : Algorithms, Fall 2013
U.C. Berkeley CS170 : Algorithms, Fall 2013 Final Professor: Satish Rao December 16, 2013 Name: Final TA: Section Time: Course Login: Person on Left: Person on Right: Answer all questions. Read them carefully
More information