1 -1 Chapter 1 Introduction. 1 -2 Why Do We Need to Study Algorithms? To learn strategies to design efficient algorithms. To understand the difficulty.

Slides:



Advertisements
Similar presentations
Algorithm Design Methods (I) Fall 2003 CSE, POSTECH.
Advertisements

Algorithm Design Methods Spring 2007 CSE, POSTECH.
Greed is good. (Some of the time)
Chapter 4 The Greedy Approach. Minimum Spanning Tree A tree is an acyclic, connected, undirected graph. A spanning tree for a given graph G=, where E.
The Theory of NP-Completeness
5-1 Chapter 5 Tree Searching Strategies. 5-2 Satisfiability problem Tree representation of 8 assignments. If there are n variables x 1, x 2, …,x n, then.
S. J. Shyu Chap. 1 Introduction 1 The Design and Analysis of Algorithms Chapter 1 Introduction S. J. Shyu.
© The McGraw-Hill Companies, Inc., Chapter 8 The Theory of NP-Completeness.
© The McGraw-Hill Companies, Inc., Chapter 2 The Complexity of Algorithms and the Lower Bounds of Problems.
高等計算機演算法 Advanced Computer Algorithms
The Design and Analysis of Algorithms
2 -1 Chapter 2 The Complexity of Algorithms and the Lower Bounds of Problems.
3 -1 Chapter 3 The Greedy Method 3 -2 The greedy method Suppose that a problem can be solved by a sequence of decisions. The greedy method has that each.
1 Approximation Algorithms CSC401 – Analysis of Algorithms Lecture Notes 18 Approximation Algorithms Objectives: Typical NP-complete problems Approximation.
The Theory of NP-Completeness
2 -1 Chapter 2 The Complexity of Algorithms and the Lower Bounds of Problems.
1 Branch and Bound Searching Strategies 2 Branch-and-bound strategy 2 mechanisms: A mechanism to generate branches A mechanism to generate a bound so.
Homework page 102 questions 1, 4, and 10 page 106 questions 4 and 5 page 111 question 1 page 119 question 9.
1 -1 Chapter 1 Introduction Why to study algorithms? Sorting problem: To sort a set of elements into increasing or decreasing order. 11, 7, 14,
Chapter 11: Limitations of Algorithmic Power
Ch 13 – Backtracking + Branch-and-Bound
9-1 Chapter 9 Approximation Algorithms. 9-2 Approximation algorithm Up to now, the best algorithm for solving an NP-complete problem requires exponential.
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
5-1 Chapter 5 Tree Searching Strategies. 5-2 Breadth-first search (BFS) 8-puzzle problem The breadth-first search uses a queue to hold all expanded nodes.
The Complexity of Algorithms and the Lower Bounds of Problems
Approximation Algorithms Motivation and Definitions TSP Vertex Cover Scheduling.
1 The Theory of NP-Completeness 2 NP P NPC NP: Non-deterministic Polynomial P: Polynomial NPC: Non-deterministic Polynomial Complete P=NP? X = P.
Approximation Algorithms
The Art Gallery Problem
The Art Gallery Problem
Lecture 6 Jianjun Hu Department of Computer Science and Engineering University of South Carolina CSCE350 Algorithms and Data Structure.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
© The McGraw-Hill Companies, Inc., Chapter 3 The Greedy Method.
1 CPSC 320: Intermediate Algorithm Design and Analysis July 25, 2014.
2 -1 Chapter 2 The Complexity of Algorithms and the Lower Bounds of Problems.
Computational Complexity Polynomial time O(n k ) input size n, k constant Tractable problems solvable in polynomial time(Opposite Intractable) Ex: sorting,
Chapter 12 Coping with the Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
Algorithms  Al-Khwarizmi, arab mathematician, 8 th century  Wrote a book: al-kitab… from which the word Algebra comes  Oldest algorithm: Euclidian algorithm.
Chapter 15 Approximation Algorithm Introduction Basic Definition Difference Bounds Relative Performance Bounds Polynomial approximation Schemes Fully Polynomial.
The Lower Bounds of Problems
1 Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples: b number of comparisons needed to find the.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
Chapter 18: Searching and Sorting Algorithms. Objectives In this chapter, you will: Learn the various search algorithms Implement sequential and binary.
Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
LIMITATIONS OF ALGORITHM POWER
Algorithm Design Methods 황승원 Fall 2011 CSE, POSTECH.
Lecture 7 Jianjun Hu Department of Computer Science and Engineering University of South Carolina CSCE350 Algorithms and Data Structure.
Lecture 25 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
© The McGraw-Hill Companies, Inc., Chapter 1 Introduction.
Lecture 19 Minimal Spanning Trees CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Branch and Bound Searching Strategies
1 CPSC 320: Intermediate Algorithm Design and Analysis July 14, 2014.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
Introduction to NP Instructor: Neelima Gupta 1.
1 The Theory of NP-Completeness 2 Review: Finding lower bound by problem transformation Problem X reduces to problem Y (X  Y ) iff X can be solved by.
Exhaustive search Exhaustive search is simply a brute- force approach to combinatorial problems. It suggests generating each and every element of the problem.
The Theory of NP-Completeness
Algorithm Design Methods
Minimum Spanning Tree Chapter 13.6.
The Complexity of Algorithms and the Lower Bounds of Problems
The Lower Bounds of Problems
3. Brute Force Selection sort Brute-Force string matching
Algorithm Design Methods
Chapter 1 Introduction.
Department of Computer Science & Engineering
Algorithm Design Methods
Presentation transcript:

1 -1 Chapter 1 Introduction

1 -2 Why Do We Need to Study Algorithms? To learn strategies to design efficient algorithms. To understand the difficulty of designing good algorithms for some problems, namely NP-complete problems.

1 -3 Consider the Sorting Problem Sorting problem: To sort a set of elements into increasing or decreasing order. 11, 7, 14, 1, 5, 9, 10 ↓ sort 1, 5, 7, 9, 10, 11, 14 Straight Insertion sort Quick sort

1 -4 Comparison of Two Algorithms Implemented on Two Computers A bad algorithm implemented on a fast computer does not perform as well as a good algorithm implemented on a slow computer.

1 -5

1 -6 Analysis of Algorithms Measure the goodness of algorithms efficiency asymptotic notations: e.g. O(n 2 ) worst case average case amortized Measure the difficulty of problems NP-complete undecidable lower bound Is the algorithm optimal?

1 -7 0/1 Knapsack Problem Given a set of n items where each item P i has a value V i, weight W i and a limit M of the total weights, we want to select a subset of items such that the total weight does not exceed M and the total value is maximized. Given a set of n items where each item P i has a value V i, weight W i, a constant value c and a limit M of the total weights, we want to find whether there exists a subset of items such that the total weight does not exceed M and the total value >=c.

1 -8 0/1 Knapsack Problem M(weight limit) = 14 best solution: P 1, P 2, P 3, P 5 (optimal=19) This problem is NP-hard. P1P1 P2P2 P3P3 P4P4 P5P5 P6P6 P7P7 P8P8 Value Weight

1 -9 0/1 Knapsack Problem M(weight limit) = 14, c=15 There exists a solution: P 1, P 2, P 3 (16>=c) This problem is NP-complete. P1P1 P2P2 P3P3 P4P4 P5P5 P6P6 P7P7 P8P8 Value Weight

1 -10 Traveling Salesperson Problem Given: A set of n planar points Find: A closed tour which includes all points exactly once such that its total length is minimized. Given: A set of n planar points and a constant c Find: A closed tour which includes all points exactly once such that its total length is less than c. This problem is NP-complete.

1 -11 Partition Problem Given: A set of positive integers S Find S 1 and S 2 such that S 1  S 2 = , S 1  S 2 =S, (Partition into S 1 and S 2 such that the sum of S 1 is equal to that of S 2 ) e.g. S={1, 7, 10, 4, 6, 8, 13, 3} S 1 ={1, 10, 4, 8, 3} S 2 ={7, 6, 13} This problem is NP-complete.

1 -12 Given: an art gallery and a constant c Determine: whether there exists a solution where # of guards is less than c such that the entire art gallery can be monitored. This problem is NP-complete. Art Gallery Problem

1 -13 Minimal Spanning Trees Given a weighted graph G, a spanning tree T is a tree where all vertices of G are vertices of T and if an edge of T connects V i and V j, its weight is the weight of e(V i,V j ) in G. A minimal spanning tree of G is a spanning tree of G whose total weight is minimized.

1 -14 Minimum Spanning Trees graph: greedy method # of possible spanning trees for n points: n n-2 n=10 → 10 8, n=100 →

1 -15 Convex Hull Given a set of planar points, find a smallest convex polygon which contains all points. It is not obvious to find a convex hull by examining all possible solutions. divide-and-conquer

1 -16 One-Center Problem Given a set of planar points, find a smallest circle which contains all points. Prune-and-search

1 -17 Many strategies, such as the greedy approach, the divide-and-conquer approach and so on will be introduced in this book.