Discrete Mathematics CS 2610

Slides:



Advertisements
Similar presentations
22C:19 Discrete Math Algorithms and Complexity
Advertisements

College of Information Technology & Design
Problems and Their Classes
MATH 224 – Discrete Mathematics
Discrete Structures CISC 2315
1 The Limits of Computation Intractable and Non-computable functions.
CompSci 102 Discrete Math for Computer Science
CSE115/ENGR160 Discrete Mathematics 03/03/11 Ming-Hsuan Yang UC Merced 1.
NP-Complete Problems Problems in Computer Science are classified into
Analysis of Algorithms CS 477/677
CSE115/ENGR160 Discrete Mathematics 03/10/11
CS10 The Beauty and Joy of Computing Lecture #23 : Limits of Computing Thanks to the success of the Kinect, researchers all over the world believe.
Analysis of Algorithm.
1 Section 2.3 Complexity of Algorithms. 2 Computational Complexity Measure of algorithm efficiency in terms of: –Time: how long it takes computer to solve.
February 17, 2015Applied Discrete Mathematics Week 3: Algorithms 1 Double Summations Table 2 in 4 th Edition: Section th Edition: Section th.
Chapter Complexity of Algorithms –Time Complexity –Understanding the complexity of Algorithms 1.
Computational Complexity Polynomial time O(n k ) input size n, k constant Tractable problems solvable in polynomial time(Opposite Intractable) Ex: sorting,
Scott Perryman Jordan Williams.  NP-completeness is a class of unsolved decision problems in Computer Science.  A decision problem is a YES or NO answer.
Discrete Mathematics Algorithms. Introduction  An algorithm is a finite set of instructions with the following characteristics:  Precision: steps are.
2.3 Functions A function is an assignment of each element of one set to a specific element of some other set. Synonymous terms: function, assignment, map.
1 Ethics of Computing MONT 113G, Spring 2012 Session 13 Limits of Computer Science.
Chapter 3 Sec 3.3 With Question/Answer Animations 1.
22C:19 Discrete Structures Algorithms and Complexity Fall 2014 Sukumar Ghosh.
Unsolvability and Infeasibility. Computability (Solvable) A problem is computable if it is possible to write a computer program to solve it. Can all problems.
Fall 2002CMSC Discrete Structures1 Enough Mathematical Appetizers! Let us look at something more interesting: Algorithms.
P, NP, and Exponential Problems Should have had all this in CS 252 – Quick review Many problems have an exponential number of possibilities and we can.
Cliff Shaffer Computer Science Computational Complexity.
Chapter Algorithms 3.2 The Growth of Functions 3.3 Complexity of Algorithms 3.4 The Integers and Division 3.5 Primes and Greatest Common Divisors.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
3.3 Complexity of Algorithms
Beauty and Joy of Computing Limits of Computing Ivona Bezáková CS10: UC Berkeley, April 14, 2014 (Slides inspired by Dan Garcia’s slides.)
SNU OOPSLA Lab. 1 Great Ideas of CS with Java Part 1 WWW & Computer programming in the language Java Ch 1: The World Wide Web Ch 2: Watch out: Here comes.
CS10: The Beauty and Joy of Computing Lecture #22 Limits of Computing Warning sign posted at Stern Hall. Also, Apple releases new operating.
Module #7: Algorithmic Complexity Rosen 5 th ed., §2.3.
The Fundamentals. Algorithms What is an algorithm? An algorithm is “a finite set of precise instructions for performing a computation or for solving.
ALGORITHMS.
Complexity & Computability. Limitations of computer science  Major reasons useful calculations cannot be done:  execution time of program is too long.
The Beauty and Joy of Computing Lecture #23 Limits of Computing Researchers at Facebook and the University of Milan found that the avg # of “friends” separating.
Feasibility and Infeasibility Are all problems easy to solve?
Young CS 331 D&A of Algo. NP-Completeness1 NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and.
Optimization/Decision Problems Optimization Problems – An optimization problem is one which asks, “What is the optimal solution to problem X?” – Examples:
Chapter 12 Theory of Computation Introduction to CS 1 st Semester, 2014 Sanghyun Park.
Copyright © 2014 Curt Hill Algorithm Analysis How Do We Determine the Complexity of Algorithms.
Ch03-Algorithms 1. Algorithms What is an algorithm? An algorithm is a finite set of precise instructions for performing a computation or for solving a.
Discrete Mathematics Chapter 2 The Fundamentals : Algorithms, the Integers, and Matrices. 大葉大學 資訊工程系 黃鈴玲.
CSE15 Discrete Mathematics 03/06/17
COT 3100, Spring 2001 Applications of Discrete Structures
Chapter 10 NP-Complete Problems.
Growth of Functions & Algorithms
Applied Discrete Mathematics Week 2: Functions and Sequences
CSE15 Discrete Mathematics 03/13/17
Analysis of Algorithms & Orders of Growth
Enough Mathematical Appetizers!
CSS 342 Data Structures, Algorithms, and Discrete Mathematics I
CS 2210 Discrete Structures Algorithms and Complexity
Algorithm design and Analysis
CSS 342 Data Structures, Algorithms, and Discrete Mathematics I
Module #7: Algorithmic Complexity
CS 2210 Discrete Structures Algorithms and Complexity
Applied Discrete Mathematics Week 6: Computation
Discrete Mathematics and its Applications
Module #7: Algorithmic Complexity
Enough Mathematical Appetizers!
CSCE 222 Discrete Structures for Computing
NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and Johnson, W.H. Freeman and Company, 1979.
Enough Mathematical Appetizers!
Discrete Mathematics 7th edition, 2009
Discrete Mathematics CS 2610
CS 2210 Discrete Structures Algorithms and Complexity
Presentation transcript:

Discrete Mathematics CS 2610 February 24, 2009 -- part 5

Algorithm- Insertion Sort For each element: The elements on its left are already sorted Shift the element with the element on the left until it is in the correct place. See animation http://math.hws.edu/TMCM/java/xSortLab/

Algorithm- Insertion Sort procedure insertSort (a1, a2, …, an: distinct integers) for j=2 to n begin i=j - 1 while i > 0 and ai > ai+1 swap ai and ai+1 i=i-1 end Worst-Case: The sequence is in decreasing order At step j, the while loop condition is executed j times the body of the loop is executed j-1 times

Greedy Algorithms Can you think of a better solution ? Problem: Assign meeting to conference rooms Policy: In decreasing order of room capacity, assign a meeting to the next largest available room Room A 200 Room B 150 Room C 150 Room D 100 Room E 75 Room F 50 Meeting 1: 70 Meeting 2: 46 Meeting 3: 125 Meeting 4: 110 Meeting 5: 30 Meeting 6: 87 M 1 M 2 Can you think of a better solution ? M3 X M5 X

Greedy Algorithm Policy: : In ascending order of room capacity, assign a meeting to the smallest room that can hold the meeting. Room A 200 Room B 150 Room C 150 Room D 100 Room E 75 Room F 50 Meeting 1:70 Meeting 2:46 Meeting 3:125 Meeting 4:110 Meeting 5:30 Meeting 6:87 M 2 M 1 M5 M3 M4 M6

Order of Growth Terminology O(1) Constant O(log cn) Logarithmic (c  Z+) O(logc n) Polylogarithmic (c  Z+) O(n) Linear O(nc) Polynomial (c  Z+) O(cn) Exponential (c  Z+) O(n!) Factorial Best Worst

Complexity of Problems Tractable A problem that can be solved with a deterministic polynomial (or better) worst-case time complexity. Also denoted as P Example: Search Problem Sorting problem Find the maximum

Complexity of Problems Intractable Problems that are not tractable. Example: Traveling salesperson problem Wide use of greedy algorithms to get an approximate solution. For example under certain circumstances you can get an approximation that is at most double the optimal solution.

P vs. NP NP: Solvable problems whose solution can be checked in polynomial time. PNP The most famous unproven conjecture in computer science is that this inclusion is proper. PNP rather than P=NP

Complexity of Problems Not Solvable Proven to have no algorithm that computes it Example: Halting problem (Alan Turing) Determine whether an arbitrary given algorithm, will eventually halt for any given finite input. Corollary: The question of whether or not a program halts for a given input is unsolvable.