Math 4242 Polynomial Time algorithms, IndependentSet problem
|
|
- Valentine Lee
- 5 years ago
- Views:
Transcription
1 Math 4242 Polynomial Time algorithms, IndependentSet problem Many of the algorithms we have looked at so far have a reasonable running time. Not all algorithms do. We make this idea more precise. Definition: An algorithm is said to be a polytime or polynomial-time algorithm if its algorithmiccomplexity is at most a POLYNOMIAL function of the size of its input. More precisely an algorithm is said to be a polynomial-time algorithm if there exists a polynomial p and a natural number N with the property that whenever t > N and when the algorithm is given an input of length t (machine-words), then the number of steps (machine-word operations) required by the algorithm is at most p(t). EndDefinition We must talk about the size of the input. It is common to measure the length of input in machinewords (so groupings of 32 or 64 wires/bits). We must also compare this to the algorithmic complexity of the algorithm, which we measure in terms of the number of machine-word operations. To show an algorithm is a polynomial-time algorithm, one typically has a function describing (upperbounding) the algorithmic complexity of the algorithm, and show this function is less than or equal to another function a polynomial evaluated at the length of the input to the function. Example: The selection sort algorithm takes as input a list of t numbers, each of which is a fixedprecision number that fits in a machine-word. The selection sort algorithm consists of O(t 2 ) operations; each of those operations requires comparing or moving these numbers (so each operation is a machineword operation). So the number of machine-word operations required by the selection sort algorithm is at most Ct 2, where C is a constant depending on the implementation, but does not depend on n the length of the list. Let p(t) = Ct 2, and let N = 1, and let t > N. Then observe that since algoritmic complexity of selection-sort p(t) Ct 2 p(t) = Ct 2. So the size of the input is t machine words, and the running time of the algorithm is at most Ct 2 machine-word operations, which is (at most) a polynomial function of the length of the input size t. Hence selection sort is a polynomial-time (polytime) algorithm. Example: The binary search algorithm takes as input a list of n numbers (again each number is a fixed-precision number in a machine-word), and a given element x (also in a machine word). Thus the input to binary search has size t = n + 1 machine words. Binary search requires O(log 2 (n)) machine-word operations. Hence the number of word-operations required for binary search is at most C log 2 (n), for some constant real number C (independent of n.) Consider the polynomial p(x) = Cx. Evaluating this polynomial at the size of the input (which is n + 1) gives p(n + 1) = C(n + 1). Since algorithmic complexity of binary search C log 2 (n) C(n + 1) = p(n + 1), we see the algorithmic complexity of binary search (measured in word-operations) is at most a polynomial function of the size of the input to binary search (again measured in number of words).
2 So binary search is a polynomial-time algorithm. More concisely, since the input to binary search is n + 1 machine words, and the binary search algorithm requires at most C(n + 1) machine-word operations (in fact much less than this!) we see that the binary search algorithm is a polynomial-time algorithm. Example: The algorithm for multiplying two binary numbers takes as input two length n lists. So the input to the binary multiplication algorithm has length t = 2n machine words. The runtime of the algorithm was O(n 2 ), so the runtime is at most Cn 2 for some real number C. Hence the runtime is at most Ct 2 /4 = C t 2 which is clearly a polynomial in t the length of the input. Thus this algorithm is a polytime algorithm. Example: There are polynomial time algorithms for solving linear programs. Meaning if one describes a linear program as some sequence of data (that data would involve numbers for the coefficients of the objective function, and numbers describing the coefficients involved in the constraints, and so on.) There are algorithms that output the optimal solution to the optimization problem described by this linear program, and the runtime of the algorithm is at most a polynomial in the length of the input (the amount of data required to describe the linear program.) Most of the algorithms we have studied have had big-o complexity of either O(log 2 (n)), or O(n), or O(n log 2 (n)), or O(n 2 ), and for the most part using arguments like the above one easily sees these algorithms are polytime algorithms also. Non-example Some algorithms take inputs of very small length and have to output a lot of data. The following algorithm is an example of this sort and is NOT a polynomial time algorithm. Consider an algorithm that takes as input an array of length t of the form [0, 0, 0, 0, 0,..., 1] representing a number n = 2 t 1 in binary. The algorithm outputs the list of numbers [1, 2, 3,..., n]. The size of the input of the algorithm is t. However this algorithm clearly requires at least Cn = C2 t 1 steps to do its job, because the output list has length n. So this algorithm has an input of size t machine words, and requires C2 t 1 machine-word operations to run. Is this algorithm s runtime at most polynomial function of its input? In other words can we ever have a polynomial p such that 2 t 1 p(t) for all large t? No. So this algorithm is not a polynomial time algorithm. The number of steps required is vastly more than the size of the input in fact the number of steps is an EXPONENTIAL function of the size of the input. So not all algorithms are polynomial time algorithms. Computer scientists sometimes refer to polynomial-time algorithms as efficient. So if you see a computer scientist or book referring to an algorithm as efficient, they probably don t mean the colloquial meaning of the word, they mean polytime. There are good theoretical and practical reasons for using the word efficient, but always remember what it really means is polytime. Another Example Recall that an independent set in a graph G = (V, E) is a set of vertices S with the property that for each e E, e S 1. In other words there are no edges between any two of the vertices in S. For example, here is a description of a graph and a set of vertices in G. V = {1,2,3,4,5,6,7} E = { # these are the the vertices of the graph
3 {1,2}, {1,4}, {2,3}, {2,4}, {2,5}, {3,4}, {5,6}, {5,7}, } S = {1,3,6,7} Consider an algorithm that takes the above information as input. To make things concrete lets imagine that this information is contained in a file and we are writing the program in python. Can we come up with an algorithm that confirms that the set S is an independent set in G? How might it do this and how many operations are required? Let us describe the size of the input, approximately. Suppose the V = n, E = e, and S = m. For now lets ignore the comma s, brackets in the input. Then the number of machine words required to hold the input is at most n + 2e + m. We assume each of these fits in a machine word and so this is n + 2e + m machine words in total. If we now consider the number of brackets and commas required we get a total of 2n + 4 for the first line, then at most 4(e + 2) characters for the lines describing the edge set, and finally at most 2m + 4 characters for the line describing the set S. Hence the total size of the input is t = 2n + 4e + 2m You can imagine an algorithm in python that reads this file in line by line and picks the lines apart, and from them creates a python list that holds the vertex set, another for the edge set, and another for the set S. To check that S is indeed an independent set, the algorithm could try all possible PAIRS of vertices in S and for each one check whether that pair is NOT an edge in the graph. If we ever find a pair of vertices in S that is an edge in G, then S is not an independent set. Otherwise no pair of vertices in S form an edge and so S is an independent set. The amount of work required by this algorithm comes in two parts. First the part that reads in the 2n + 4e + 2m + 16 characters in the file and makes the lists and the second part would be checking whether any of the m(m 1) pairs of vertices in S form an edge (by looking in the list of edges). There are 2 many ways to do this, but one can imagine a simple nested loop to try all pairs of vertices i, j in S and for each another loop that traverses the list of e edges in G checking that none of them is {i, j}. (There are faster ways to do this, for example using a hash table. We don t care right now.) An estimate of the number of machine-word operations required by this algorithm is: C 1 (2n + 4e + 2m + 16) + C 2 ( m(m 1) )e). 2 We claim that this expression is at most a polynomial in t the total size of the input. For example note that the above expression is obviously less than C 1 (t) + C 2 (t 3 ),
4 which is a polynomial in t. Since the amount of work required by this algorithm is at most a polynomial in the size of the input to the algorithm, this algorithm is a POLYNOMIAL TIME ALGORITHM. 1 THE DECISION-INDEPENDENT-SET problem. Recall a graph is a pair consisting of a vertex set and edge set. You may have also seen the definition of an independent set of vertices in a graph is a set of vertices in a graph that have no edge of the graph between any two of them. The decision-independent set problem is as follows. Given an encoding of a graph (a string, say, describing the vertex and edge set of the graph) and and integer m, determine if the graph described contains AN independent set of size m. The input to such an algorithm would look like (as above): V = {1,2,3,... n} E = {... {vertex, vertex } } m # desired minimum size of independent set of vertices An algorithm solving the decision-independent set problem would take, as input, a string encoding the above data, and the job of the algorithm is to always correctly output yes or no, depending on whether or not the given graph has an independent set of size at least m or not. It is important to understand that there ARE algorithms that (correctly!) solve the problem, in that they output the correct answer for a given input. For example given the input string describing a graph on n vertices and an independent set of size at least k, one could exhaustively try every possible vertex set of size k and test whether it is an independent set in the graph. However this exhaustive algorithm has very very many steps in comparison to the size of its input and it is easy to show this exhaustive search algorithm is not a polynomial time algorithm. To elaborate on the above, suppose we were interested in whether a graph G with n vertices contains an independent set of size n/2. To answer this question using the above method, we would have to try each of the n choose n/2 possible vertex subsets of size n/2, and for each of them use the previous algorithm to check whether that vertex subset is an independent set in the graph of not. So at a minimum then, this algorithm would have to perform n chooose n/2 machine word operations, and in reality it would be a good deal more than this. However, note that ( ) 2 n n n + 1, n/2 which can be seen by considering the binomial expansion of (1+1) n, and noting that the largest binomial coefficient is the middle one, and this largest one must be larger than the average value of all the binomial coefficients.
5 This means that the above algorithm is not a polynomial time algorithm, because if it was we would have a polynomial in n with the property that but since this would give that cost of algorithm p(n) ( ) 2 n n n + 1 cost of algorithm n/2 2 n a polynomial in n which is clearly impossible using what we know about exponential functions an exponential function will always be (eventually!!! for large enough n) larger than any polynomial in n. Hence the ABOVE algorithm for answering the decision independent set problem (when m = n/2 at least) is NOT a polynomial time algorithm. You might wonder whether we are just being stupid above and maybe there is a better way to solve this problem. However, although many smart people have tried, as of today nobody knows an algorithm which answers the decision independent set problem above (with m = n/2) (correctly!) and whose worst-case runtime is at most a polynomial function of the size of the input. This means all known algorithms we have for solving the decision independent set problem have a worst-case run-time that is too big to be of use for all except very very small graphs. This is an important problem that shows up in many places you would not expect. So people are interested in solving it. But we don t have good (polytime) algorithms to solve it. We will explore this problem and how it relates to other hard problems in the coming lectures.
Algorithm Analysis. College of Computing & Information Technology King Abdulaziz University. CPCS-204 Data Structures I
Algorithm Analysis College of Computing & Information Technology King Abdulaziz University CPCS-204 Data Structures I Order Analysis Judging the Efficiency/Speed of an Algorithm Thus far, we ve looked
More informationWhat is an algorithm?
Reminders CS 142 Lecture 3 Analysis, ADTs & Objects Program 1 was assigned - Due on 1/27 by 11:55pm 2 Abstraction Measuring Algorithm Efficiency When you utilize the mylist.index(item) function you are
More informationComputer Science 210 Data Structures Siena College Fall Topic Notes: Complexity and Asymptotic Analysis
Computer Science 210 Data Structures Siena College Fall 2017 Topic Notes: Complexity and Asymptotic Analysis Consider the abstract data type, the Vector or ArrayList. This structure affords us the opportunity
More informationData Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi
Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture 20 Priority Queues Today we are going to look at the priority
More information1 Definition of Reduction
1 Definition of Reduction Problem A is reducible, or more technically Turing reducible, to problem B, denoted A B if there a main program M to solve problem A that lacks only a procedure to solve problem
More informationAlgorithm Analysis. (Algorithm Analysis ) Data Structures and Programming Spring / 48
Algorithm Analysis (Algorithm Analysis ) Data Structures and Programming Spring 2018 1 / 48 What is an Algorithm? An algorithm is a clearly specified set of instructions to be followed to solve a problem
More informationCSE373: Data Structures and Algorithms Lecture 4: Asymptotic Analysis. Aaron Bauer Winter 2014
CSE373: Data Structures and Algorithms Lecture 4: Asymptotic Analysis Aaron Bauer Winter 2014 Previously, on CSE 373 We want to analyze algorithms for efficiency (in time and space) And do so generally
More informationLecture 7: Efficient Collections via Hashing
Lecture 7: Efficient Collections via Hashing These slides include material originally prepared by Dr. Ron Cytron, Dr. Jeremy Buhler, and Dr. Steve Cole. 1 Announcements Lab 6 due Friday Lab 7 out tomorrow
More information15-451/651: Design & Analysis of Algorithms November 4, 2015 Lecture #18 last changed: November 22, 2015
15-451/651: Design & Analysis of Algorithms November 4, 2015 Lecture #18 last changed: November 22, 2015 While we have good algorithms for many optimization problems, the previous lecture showed that many
More information10/5/2016. Comparing Algorithms. Analyzing Code ( worst case ) Example. Analyzing Code. Binary Search. Linear Search
10/5/2016 CSE373: Data Structures and Algorithms Asymptotic Analysis (Big O,, and ) Steve Tanimoto Autumn 2016 This lecture material represents the work of multiple instructors at the University of Washington.
More information/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Sorting lower bound and Linear-time sorting Date: 9/19/17
601.433/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Sorting lower bound and Linear-time sorting Date: 9/19/17 5.1 Introduction You should all know a few ways of sorting in O(n log n)
More informationPrinciples of Algorithm Design
Principles of Algorithm Design When you are trying to design an algorithm or a data structure, it s often hard to see how to accomplish the task. The following techniques can often be useful: 1. Experiment
More informationSolutions to Math 381 Quiz 2
Solutions to Math 381 Quiz 2 November 7, 2018 (1) In one sentence, what is the goal of your class project? Each team has a different answer here. (2) Write a function in Python which computes a linear
More informationsuch a manner that we are able to understand, grasp and grapple with the problem at hand in a more organized fashion.
Programming and Data Structure Dr.P.P.Chakraborty Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture 32 Conclusions Hello everybody. Today, we come to the
More informationSteven Skiena. skiena
Lecture 22: Introduction to NP-completeness (1997) Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794 4400 http://www.cs.sunysb.edu/ skiena Among n people,
More informationEncoding/Decoding, Counting graphs
Encoding/Decoding, Counting graphs Russell Impagliazzo and Miles Jones Thanks to Janine Tiefenbruck http://cseweb.ucsd.edu/classes/sp16/cse21-bd/ May 13, 2016 11-avoiding binary strings Let s consider
More informationCSE 332 Winter 2015: Midterm Exam (closed book, closed notes, no calculators)
_ UWNetID: Lecture Section: A CSE 332 Winter 2015: Midterm Exam (closed book, closed notes, no calculators) Instructions: Read the directions for each question carefully before answering. We will give
More informationCPSC 536N: Randomized Algorithms Term 2. Lecture 5
CPSC 536N: Randomized Algorithms 2011-12 Term 2 Prof. Nick Harvey Lecture 5 University of British Columbia In this lecture we continue to discuss applications of randomized algorithms in computer networking.
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 information/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Priority Queues / Heaps Date: 9/27/17
01.433/33 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Priority Queues / Heaps Date: 9/2/1.1 Introduction In this lecture we ll talk about a useful abstraction, priority queues, which are
More informationQuestions. 6. Suppose we were to define a hash code on strings s by:
Questions 1. Suppose you are given a list of n elements. A brute force method to find duplicates could use two (nested) loops. The outer loop iterates over position i the list, and the inner loop iterates
More informationSearch Lesson Outline
1. Searching Lesson Outline 2. How to Find a Value in an Array? 3. Linear Search 4. Linear Search Code 5. Linear Search Example #1 6. Linear Search Example #2 7. Linear Search Example #3 8. Linear Search
More informationCSE 373 Spring 2010: Midterm #1 (closed book, closed notes, NO calculators allowed)
Name: Email address: CSE 373 Spring 2010: Midterm #1 (closed book, closed notes, NO calculators allowed) Instructions: Read the directions for each question carefully before answering. We may give partial
More informationCSE101: Design and Analysis of Algorithms. Ragesh Jaiswal, CSE, UCSD
Recap. Growth rates: Arrange the following functions in ascending order of growth rate: n 2 log n n log n 2 log n n/ log n n n Introduction Algorithm: A step-by-step way of solving a problem. Design of
More informationLecture 2: Analyzing Algorithms: The 2-d Maxima Problem
Lecture 2: Analyzing Algorithms: The 2-d Maxima Problem (Thursday, Jan 29, 1998) Read: Chapter 1 in CLR. Analyzing Algorithms: In order to design good algorithms, we must first agree the criteria for measuring
More informationCMPSCI 187: Programming With Data Structures. Lecture 5: Analysis of Algorithms Overview 16 September 2011
CMPSCI 187: Programming With Data Structures Lecture 5: Analysis of Algorithms Overview 16 September 2011 Analysis of Algorithms Overview What is Analysis of Algorithms? L&C s Dishwashing Example Being
More informationEncoding/Decoding and Lower Bound for Sorting
Encoding/Decoding and Lower Bound for Sorting CSE21 Winter 2017, Day 19 (B00), Day 13 (A00) March 1, 2017 http://vlsicad.ucsd.edu/courses/cse21-w17 Announcements HW #7 assigned Due: Tuesday 2/7 11:59pm
More informationLecture 20: Satisfiability Steven Skiena. Department of Computer Science State University of New York Stony Brook, NY
Lecture 20: Satisfiability Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794 4400 http://www.cs.sunysb.edu/ skiena Problem of the Day Suppose we are given
More informationx 2 + 3, r 4(x) = x2 1
Math 121 (Lesieutre); 4.2: Rational functions; September 1, 2017 1. What is a rational function? It s a function of the form p(x), where p(x) and q(x) are both polynomials. In other words, q(x) something
More informationPolynomial SAT-Solver Algorithm Explanation
1 Polynomial SAT-Solver Algorithm Explanation by Matthias Mueller (a.k.a. Louis Coder) louis@louis-coder.com Explanation Version 1.0 - December 1, 2013 Abstract This document describes an algorithm that
More informationName: Lirong TAN 1. (15 pts) (a) Define what is a shortest s-t path in a weighted, connected graph G.
1. (15 pts) (a) Define what is a shortest s-t path in a weighted, connected graph G. A shortest s-t path is a path from vertex to vertex, whose sum of edge weights is minimized. (b) Give the pseudocode
More informationSORTING AND SEARCHING
SORTING AND SEARCHING Today Last time we considered a simple approach to sorting a list of objects. This lecture will look at another approach to sorting. We will also consider how one searches through
More informationDesign and Analysis of Algorithms Prof. Madhavan Mukund Chennai Mathematical Institute. Module 02 Lecture - 45 Memoization
Design and Analysis of Algorithms Prof. Madhavan Mukund Chennai Mathematical Institute Module 02 Lecture - 45 Memoization Let us continue our discussion of inductive definitions. (Refer Slide Time: 00:05)
More information/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/27/18
601.433/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/27/18 22.1 Introduction We spent the last two lectures proving that for certain problems, we can
More informationData Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi.
Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture 18 Tries Today we are going to be talking about another data
More information: Intro Programming for Scientists and Engineers Final Exam
Final Exam Page 1 of 6 600.112: Intro Programming for Scientists and Engineers Final Exam Peter H. Fröhlich phf@cs.jhu.edu December 20, 2012 Time: 40 Minutes Start here: Please fill in the following important
More informationCMPSCI611: Approximating SET-COVER Lecture 21
CMPSCI611: Approximating SET-COVER Lecture 21 Today we look at two more examples of approximation algorithms for NP-hard optimization problems. The first, for the SET-COVER problem, has an approximation
More informationGreedy Algorithms 1 {K(S) K(S) C} For large values of d, brute force search is not feasible because there are 2 d {1,..., d}.
Greedy Algorithms 1 Simple Knapsack Problem Greedy Algorithms form an important class of algorithmic techniques. We illustrate the idea by applying it to a simplified version of the Knapsack Problem. Informally,
More informationGreedy algorithms is another useful way for solving optimization problems.
Greedy Algorithms Greedy algorithms is another useful way for solving optimization problems. Optimization Problems For the given input, we are seeking solutions that must satisfy certain conditions. These
More informationExamples of P vs NP: More Problems
Examples of P vs NP: More Problems COMP1600 / COMP6260 Dirk Pattinson Australian National University Semester 2, 2017 Catch Up / Drop in Lab When Fridays, 15.00-17.00 Where N335, CSIT Building (bldg 108)
More informationExtended Introduction to Computer Science CS1001.py Lecture 7: Basic Algorithms: Sorting, Merge; Time Complexity and the O( ) notation
Extended Introduction to Computer Science CS1001.py Lecture 7: Basic Algorithms: Sorting, Merge; Time Complexity and the O( ) notation Instructors: Daniel Deutch, Amir Rubinstein Teaching Assistants: Michal
More information(Refer Slide Time: 1:40)
Computer Architecture Prof. Anshul Kumar Department of Computer Science and Engineering, Indian Institute of Technology, Delhi Lecture - 3 Instruction Set Architecture - 1 Today I will start discussion
More informationCITS3001. Algorithms, Agents and Artificial Intelligence. Semester 2, 2016
CITS3001 Algorithms, Agents and Artificial Intelligence Semester 2, 2016 Tim French School of Computer Science & Software Eng. The University of Western Australia 2. Review of algorithmic concepts CLRS,
More informationPolynomial-Time Approximation Algorithms
6.854 Advanced Algorithms Lecture 20: 10/27/2006 Lecturer: David Karger Scribes: Matt Doherty, John Nham, Sergiy Sidenko, David Schultz Polynomial-Time Approximation Algorithms NP-hard problems are a vast
More informationIntro to Algorithms. Professor Kevin Gold
Intro to Algorithms Professor Kevin Gold What is an Algorithm? An algorithm is a procedure for producing outputs from inputs. A chocolate chip cookie recipe technically qualifies. An algorithm taught in
More informationPROGRAM EFFICIENCY & COMPLEXITY ANALYSIS
Lecture 03-04 PROGRAM EFFICIENCY & COMPLEXITY ANALYSIS By: Dr. Zahoor Jan 1 ALGORITHM DEFINITION A finite set of statements that guarantees an optimal solution in finite interval of time 2 GOOD ALGORITHMS?
More informationComputer Algorithms-2 Prof. Dr. Shashank K. Mehta Department of Computer Science and Engineering Indian Institute of Technology, Kanpur
Computer Algorithms-2 Prof. Dr. Shashank K. Mehta Department of Computer Science and Engineering Indian Institute of Technology, Kanpur Lecture - 6 Minimum Spanning Tree Hello. Today, we will discuss an
More informationSimple Graph. General Graph
Graph Theory A graph is a collection of points (also called vertices) and lines (also called edges), with each edge ending at a vertex In general, it is allowed for more than one edge to have the same
More informationCOMP 250 Fall recurrences 2 Oct. 13, 2017
COMP 250 Fall 2017 15 - recurrences 2 Oct. 13, 2017 Here we examine the recurrences for mergesort and quicksort. Mergesort Recall the mergesort algorithm: we divide the list of things to be sorted into
More informationElementary maths for GMT. Algorithm analysis Part II
Elementary maths for GMT Algorithm analysis Part II Algorithms, Big-Oh and Big-Omega An algorithm has a O( ) and Ω( ) running time By default, we mean the worst case running time A worst case O running
More informationLecture 05 I/O statements Printf, Scanf Simple statements, Compound statements
Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 05 I/O statements Printf, Scanf Simple
More informationThe Satisfiability Problem [HMU06,Chp.10b] Satisfiability (SAT) Problem Cook s Theorem: An NP-Complete Problem Restricted SAT: CSAT, k-sat, 3SAT
The Satisfiability Problem [HMU06,Chp.10b] Satisfiability (SAT) Problem Cook s Theorem: An NP-Complete Problem Restricted SAT: CSAT, k-sat, 3SAT 1 Satisfiability (SAT) Problem 2 Boolean Expressions Boolean,
More informationAssignment 5: Solutions
Algorithm Design Techniques Assignment 5: Solutions () Port Authority. [This problem is more commonly called the Bin Packing Problem.] (a) Suppose K = 3 and (w, w, w 3, w 4 ) = (,,, ). The optimal solution
More informationSolution to Graded Problem Set 4
Graph Theory Applications EPFL, Spring 2014 Solution to Graded Problem Set 4 Date: 13.03.2014 Due by 18:00 20.03.2014 Problem 1. Let V be the set of vertices, x be the number of leaves in the tree and
More informationIntroduction. two of the most fundamental concepts in computer science are, given an array of values:
Searching Class 28 Introduction two of the most fundamental concepts in computer science are, given an array of values: search through the values to see if a specific value is present and, if so, where
More informationMITOCW watch?v=hverxup4cfg
MITOCW watch?v=hverxup4cfg PROFESSOR: We've briefly looked at graph isomorphism in the context of digraphs. And it comes up in even more fundamental way really for simple graphs where the definition is
More informationCS 125 Section #4 RAMs and TMs 9/27/16
CS 125 Section #4 RAMs and TMs 9/27/16 1 RAM A word-ram consists of: A fixed set of instructions P 1,..., P q. Allowed instructions are: Modular arithmetic and integer division on registers; the standard
More informationAnalysis of Algorithms. 5-Dec-16
Analysis of Algorithms 5-Dec-16 Time and space To analyze an algorithm means: developing a formula for predicting how fast an algorithm is, based on the size of the input (time complexity), and/or developing
More informationData Structures. Topic #7
Data Structures Topic #7 Today s Agenda How to measure the efficiency of algorithms? Discuss program #3 in detail Review for the midterm what material to study types of questions walk through a sample
More informationWeek - 04 Lecture - 01 Merge Sort. (Refer Slide Time: 00:02)
Programming, Data Structures and Algorithms in Python Prof. Madhavan Mukund Department of Computer Science and Engineering Indian Institute of Technology, Madras Week - 04 Lecture - 01 Merge Sort (Refer
More information(Refer Slide Time: 1:43)
(Refer Slide Time: 1:43) Digital Circuits and Systems Prof. S. Srinivasan Department of Electrical Engineering Indian Institute of Technology, Madras Lecture - 27 Pattern Detector So, we talked about Moore
More informationAlgorithms. Chapter 8. Objectives After studying this chapter, students should be able to:
Objectives After studying this chapter, students should be able to: Chapter 8 Algorithms Define an algorithm and relate it to problem solving. Define three construct and describe their use in algorithms.
More informationAlgorithms and Data Structures
Algorithms and Data Structures Spring 2019 Alexis Maciel Department of Computer Science Clarkson University Copyright c 2019 Alexis Maciel ii Contents 1 Analysis of Algorithms 1 1.1 Introduction.................................
More informationCS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims. Lecture 10: Asymptotic Complexity and
CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims Lecture 10: Asymptotic Complexity and What Makes a Good Algorithm? Suppose you have two possible algorithms or
More informationLecture 5 Sorting Arrays
Lecture 5 Sorting Arrays 15-122: Principles of Imperative Computation (Spring 2018) Frank Pfenning, Rob Simmons We begin this lecture by discussing how to compare running times of functions in an abstract,
More informationRecitation 9. Prelim Review
Recitation 9 Prelim Review 1 Heaps 2 Review: Binary heap min heap 1 2 99 4 3 PriorityQueue Maintains max or min of collection (no duplicates) Follows heap order invariant at every level Always balanced!
More informationCPSC 320: Intermediate Algorithm Design and Analysis. Tutorial: Week 3
CPSC 320: Intermediate Algorithm Design and Analysis Author: Susanne Bradley Tutorial: Week 3 At the time of this week s tutorial, we were approaching the end of our stable matching unit and about to start
More informationLecture 24: More Reductions (1997) Steven Skiena. skiena
Lecture 24: More Reductions (1997) Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794 4400 http://www.cs.sunysb.edu/ skiena Prove that subgraph isomorphism
More informationMidterm 2 Solutions. CS70 Discrete Mathematics for Computer Science, Fall 2007
CS70 Discrete Mathematics for Computer Science, Fall 007 Midterm Solutions Note: These solutions are not necessarily model answers Rather, they are designed to be tutorial in nature, and sometimes contain
More informationInsertion Sort: an algorithm for sorting an array
Insertion Sort: an algorithm for sorting an array Let s use arrays to solve a problem that comes up often in programming, namely sorting. Suppose we have an array of objects that is in no particular order
More informationNotes slides from before lecture. CSE 21, Winter 2017, Section A00. Lecture 4 Notes. Class URL:
Notes slides from before lecture CSE 21, Winter 2017, Section A00 Lecture 4 Notes Class URL: http://vlsicad.ucsd.edu/courses/cse21-w17/ Notes slides from before lecture Notes January 23 (1) HW2 due tomorrow
More informationChapter 8 Algorithms 1
Chapter 8 Algorithms 1 Objectives After studying this chapter, the student should be able to: Define an algorithm and relate it to problem solving. Define three construct and describe their use in algorithms.
More information8 Matroid Intersection
8 Matroid Intersection 8.1 Definition and examples 8.2 Matroid Intersection Algorithm 8.1 Definitions Given two matroids M 1 = (X, I 1 ) and M 2 = (X, I 2 ) on the same set X, their intersection is M 1
More informationHi everyone. Starting this week I'm going to make a couple tweaks to how section is run. The first thing is that I'm going to go over all the slides
Hi everyone. Starting this week I'm going to make a couple tweaks to how section is run. The first thing is that I'm going to go over all the slides for both problems first, and let you guys code them
More informationIntroduction to Programming in C Department of Computer Science and Engineering. Lecture No. #19. Loops: Continue Statement Example
Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #19 Loops: Continue Statement Example Let us do a sample program using continue statements, I will introduce
More informationLecture 7 Quicksort : Principles of Imperative Computation (Spring 2018) Frank Pfenning
Lecture 7 Quicksort 15-122: Principles of Imperative Computation (Spring 2018) Frank Pfenning In this lecture we consider two related algorithms for sorting that achieve a much better running time than
More informationLecture 16. Reading: Weiss Ch. 5 CSE 100, UCSD: LEC 16. Page 1 of 40
Lecture 16 Hashing Hash table and hash function design Hash functions for integers and strings Collision resolution strategies: linear probing, double hashing, random hashing, separate chaining Hash table
More informationMore Algorithm Analysis
More Algorithm Analysis College of Computing & Information Technology King Abdulaziz University CPCS-204 Data Structures I Examples of Analyzing Code: We now go over many examples of code fragments Each
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 informationCS 231 Data Structures and Algorithms Fall Algorithm Analysis Lecture 16 October 10, Prof. Zadia Codabux
CS 231 Data Structures and Algorithms Fall 2018 Algorithm Analysis Lecture 16 October 10, 2018 Prof. Zadia Codabux 1 Agenda Algorithm Analysis 2 Administrative No quiz this week 3 Algorithm Analysis 4
More informationCSC263 Week 12. Larry Zhang
CSC263 Week 12 Larry Zhang Announcements No tutorial this week PS5-8 being marked Course evaluation: available on Portal http://uoft.me/course-evals Lower Bounds So far, we have mostly talked about upperbounds
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 informationSolving Linear Recurrence Relations (8.2)
EECS 203 Spring 2016 Lecture 18 Page 1 of 10 Review: Recurrence relations (Chapter 8) Last time we started in on recurrence relations. In computer science, one of the primary reasons we look at solving
More information1 Algorithm and Proof for Minimum Vertex Coloring
Solutions to Homework 7, CS 173A (Fall 2018) Homework 7 asked you to show that the construction problems Maximum Independent Set, Minimum Vertex Coloring, and Maximum Clique could all be solved in polynomial
More information(Refer Slide Time: 0:19)
Theory of Computation. Professor somenath Biswas. Department of Computer Science & Engineering. Indian Institute of Technology, Kanpur. Lecture-15. Decision Problems for Regular Languages. (Refer Slide
More information8 Algorithms 8.1. Foundations of Computer Science Cengage Learning
8 Algorithms 8.1 Foundations of Computer Science Cengage Learning 8.2 Objectives After studying this chapter, the student should be able to: Define an algorithm and relate it to problem solving. Define
More informationAnalysis of Algorithms
ITP21 - Foundations of IT 1 Analysis of Algorithms Analysis of algorithms Analysis of algorithms is concerned with quantifying the efficiency of algorithms. The analysis may consider a variety of situations:
More informationLecture 9 March 4, 2010
6.851: Advanced Data Structures Spring 010 Dr. André Schulz Lecture 9 March 4, 010 1 Overview Last lecture we defined the Least Common Ancestor (LCA) and Range Min Query (RMQ) problems. Recall that an
More informationHashing. Yufei Tao. Department of Computer Science and Engineering Chinese University of Hong Kong
Department of Computer Science and Engineering Chinese University of Hong Kong In this lecture, we will revisit the dictionary search problem, where we want to locate an integer v in a set of size n or
More information1 Linear programming relaxation
Cornell University, Fall 2010 CS 6820: Algorithms Lecture notes: Primal-dual min-cost bipartite matching August 27 30 1 Linear programming relaxation Recall that in the bipartite minimum-cost perfect matching
More informationCS 6402 DESIGN AND ANALYSIS OF ALGORITHMS QUESTION BANK
CS 6402 DESIGN AND ANALYSIS OF ALGORITHMS QUESTION BANK Page 1 UNIT I INTRODUCTION 2 marks 1. Why is the need of studying algorithms? From a practical standpoint, a standard set of algorithms from different
More informationVariables and Data Representation
You will recall that a computer program is a set of instructions that tell a computer how to transform a given set of input into a specific output. Any program, procedural, event driven or object oriented
More informationWeek - 01 Lecture - 03 Euclid's Algorithm for gcd. Let us continue with our running example of gcd to explore more issues involved with program.
Programming, Data Structures and Algorithms in Python Prof. Madhavan Mukund Department of Computer Science and Engineering Indian Institute of Technology, Madras Week - 01 Lecture - 03 Euclid's Algorithm
More informationNotes and Answers to Homework Exam 1, Geometric Algorithms, 2017
Notes and Answers to Homework Exam 1, Geometric Algorithms, 2017 Below are some notes and sketches of correct answers for the first homework exam. We have also included the most common mistakes that were
More informationELEC-270 Solutions to Assignment 5
ELEC-270 Solutions to Assignment 5 1. How many positive integers less than 1000 (a) are divisible by 7? (b) are divisible by 7 but not by 11? (c) are divisible by both 7 and 11? (d) are divisible by 7
More informationQuestion And Answer.
Q.1 What is the number of swaps required to sort n elements using selection sort, in the worst case? A. Θ(n) B. Θ(n log n) C. Θ(n2) D. Θ(n2 log n) ANSWER : Option A Θ(n) Note that we
More informationTheory and Frontiers of Computer Science. Fall 2013 Carola Wenk
Theory and Frontiers of Computer Science Fall 2013 Carola Wenk We have seen so far Computer Architecture and Digital Logic (Von Neumann Architecture, binary numbers, circuits) Introduction to Python (if,
More informationAlgorithm Design and Time Analysis
Algorithm Design and Time Analysis CSE21 Winter 2017, Day 6 (B00), Day 4 (A00) January 23, 2017 http://vlsicad.ucsd.edu/courses/cse21-w17 Today s Plan Analyzing algorithms that solve other problems (besides
More informationDijkstra s algorithm for shortest paths when no edges have negative weight.
Lecture 14 Graph Algorithms II 14.1 Overview In this lecture we begin with one more algorithm for the shortest path problem, Dijkstra s algorithm. We then will see how the basic approach of this algorithm
More informationCISC
CISC-235 20180115+17+19 Much of the material we covered this week was already posted in the notes for last week. These notes take up where those left off, and fill in some gaps. We have discussed the notation
More information