11 A: Algorithm Design Techniques
|
|
- Moses James
- 7 years ago
- Views:
Transcription
1 11 A: Algorithm Design Techniques CS1102S: Data Structures and Algorithms Martin Henz March 31, 2010 Generated on Tuesday 6 th April, 2010, 14:22 CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 1
2 1 NP-Complete Problems CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 2
3 Example: Hamiltonian Cycles Given Input An undirected connected graph Desired Output A path that starts and ends in the same vertex and contains all other vertices exactly once. No efficient algorithm known We do not know if there is a k such that the problem can be solved in O(N k ). CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 3
4 Our Last Question Question If we do not have a polynomial algorithm, can we always prove that there is none? Answer No: we cannot (at this moment) prove that there is no polynomial algorithm for the Hamiltonian cycle problem CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 4
5 Verifying Solutions Example: Hamiltonian cycle problem If we have a candidate of a solution to the problem, we can easily check that it is correct. Simply check that the last vertex in the cycle is that same as the first, and that every vertex of the graph is contained in the cycle. Definition We call the class of problems for which solution candidates can be checked in polynomial time NP. CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 5
6 NP-Complete Problems Other problems in NP Boolean satisfiability problem (SAT) Graph coloring problem Clique problem Reducibility All these problems can be transformed into each other in polynomial time! Thus if we can solve one, we can solve all. NP-Complete Problems The class of problems that can be transformed into the Hamiltonian path problem in polynomial time is called the class of NP-complete problems. CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 6
7 Scheduling Huffman Codes 1 NP-Complete Problems 2 Scheduling Huffman Codes 3 4 CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 7
8 Nonpreemptive Scheduling Scheduling Huffman Codes Input A set of jobs with a running time for each Desired output A sequence for the jobs to execute on on single machine, minimizing the average completion time CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 8
9 Example NP-Complete Problems Scheduling Huffman Codes Some schedule: The optimal schedule: CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 9
10 The Multiprocessor Case Scheduling Huffman Codes N processors Now we can run the jobs on N identical machines. What is a schedule that minimizes the average completion time? CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 10
11 Example NP-Complete Problems Scheduling Huffman Codes CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 11
12 A Slight Variant NP-Complete Problems Scheduling Huffman Codes Miniming final completion time If we want to minimize the final completion time (completion time of the last task), the problem becomes NP-complete! CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 12
13 Standard Coding Scheme Scheduling Huffman Codes CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 13
14 Representation in a Tree Scheduling Huffman Codes CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 14
15 Scheduling Huffman Codes A Slightly Better Representation CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 15
16 Scheduling Huffman Codes Optimal Prefix Code in Tree Form CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 16
17 Scheduling Huffman Codes Optimal Prefix Code in Table Form CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 17
18 Scheduling Huffman Codes Huffman s Algorithm: An Example CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 18
19 Scheduling Huffman Codes Huffman s Algorithm: An Example CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 19
20 Scheduling Huffman Codes Huffman s Algorithm: An Example CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 20
21 Scheduling Huffman Codes Huffman s Algorithm: An Example CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 21
22 Scheduling Huffman Codes Huffman s Algorithm: An Example CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 22
23 Scheduling Huffman Codes Huffman s Algorithm: An Example CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 23
24 Scheduling Huffman Codes Huffman s Algorithm: An Example CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 24
25 Sorting Running Time Closest-Points Problem 1 NP-Complete Problems 2 3 Sorting Running Time Closest-Points Problem 4 CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 25
26 Sorting Running Time Closest-Points Problem Sorting using Idea of Mergesort Split array in two (trivial); sort the two (recursively); merge (linear) Idea of Quicksort Split array in two, using pivot (linear); sort the two (recursively); merge (trivial) CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 26
27 Sorting Running Time Closest-Points Problem Running Time of Algorithms Merge Sort: T(N) = 2T(N/2) + O(N) O(N log N) Generalization: T(N) = at(n/b) + Θ(N k ) T(N) = O(N log b a ) if a > b k T(N) = O(N k log N) if a = b k T(N) = O(N k ) if a < b k CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 27
28 Closest-Points Problem Sorting Running Time Closest-Points Problem Input Set of points in a plane Euclidean distance between p 1 and p 2 [(x 1 x 2 ) 2 + (y 1 y 2 ) 2 ] 1/2 Required output Find the closest pair of points CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 28
29 Example NP-Complete Problems Sorting Running Time Closest-Points Problem CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 29
30 Naive Algorithm NP-Complete Problems Sorting Running Time Closest-Points Problem Exhaustive search Compute the distance between each two points and keep the smallest Run time There are N 2 pairs to check, thus O(N 2 ) CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 30
31 Idea NP-Complete Problems Sorting Running Time Closest-Points Problem Preparation Sort points by x coordinate; O(N log N) Split point set into two halves, P L and P R. Recursively find the smallest distance in each half. Find the smallest distance of pairs that cross the separation line. CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 31
32 Sorting Running Time Closest-Points Problem Partitioning with Shortest Distances Shown CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 32
33 Two-lane Strip NP-Complete Problems Sorting Running Time Closest-Points Problem CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 33
34 Sorting Running Time Closest-Points Problem Brute Force Calculation of min(δ, d C ) CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 34
35 Better Idea NP-Complete Problems Sorting Running Time Closest-Points Problem Sort points by y coordinate This allows a scan of the strip. Sort points by y coordinate This allows a scan of the strip. CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 35
36 Sorting Running Time Closest-Points Problem Only p 4 and p 5 Need To Be Considered CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 36
37 Refined Calculation of min(δ, d C ) Sorting Running Time Closest-Points Problem CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 37
38 Sorting Running Time Closest-Points Problem At Most Eight Points Fit in Rectangle CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 38
39 Fibonacci Numbers Optimal Binary Search Tree All-pairs Shortest Path 1 NP-Complete Problems Fibonacci Numbers Optimal Binary Search Tree All-pairs Shortest Path CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 39
40 Inefficient Algorithm NP-Complete Problems Fibonacci Numbers Optimal Binary Search Tree All-pairs Shortest Path public s t a t i c i n t f i b ( i n t n ) { i f ( n <= 1) return 1; else return f i b ( n 1) + f i b ( n 2 ) ; } CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 40
41 Trace of Recursion NP-Complete Problems Fibonacci Numbers Optimal Binary Search Tree All-pairs Shortest Path CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 41
42 Memoization NP-Complete Problems Fibonacci Numbers Optimal Binary Search Tree All-pairs Shortest Path i n t [ ] f i b s = new i n t [ ] ; public s t a t i c i n t f i b ( i n t n ) { i f ( f i b s [ n ]! = 0 ) return f i b s [ n ] ; i f ( n <= 1) return 1; i n t new fib = f i b ( n 1) + f i b ( n 2 ) ; f i b s [ n ] = new fib ; return new fib ; } CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 42
43 Fibonacci Numbers Optimal Binary Search Tree All-pairs Shortest Path A Simple Loop for Fibonacci Numbers public s t a t i c i n t f i b ( i n t n ) { i f ( n <= 1) return 1; i n t l a s t = 1, nexttolast = 1; answer = 1; for ( i n t i = 2; i <= n ; i ++) { answer = l a s t + nexttolast ; nexttolast = l a s t ; l a s t = answer ; } return answer ; } CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 43
44 Sample Input NP-Complete Problems Fibonacci Numbers Optimal Binary Search Tree All-pairs Shortest Path CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 44
45 Fibonacci Numbers Optimal Binary Search Tree All-pairs Shortest Path Three Possible Binary Search Trees CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 45
46 Comparison of the Three Trees Fibonacci Numbers Optimal Binary Search Tree All-pairs Shortest Path CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 46
47 Fibonacci Numbers Optimal Binary Search Tree All-pairs Shortest Path Structure of Optimal Binary Search Tree CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 47
48 Idea NP-Complete Problems Fibonacci Numbers Optimal Binary Search Tree All-pairs Shortest Path Proceed in order of growing tree size For each range of words, compute optimal tree Memoization For each range, store optimal tree for later retrieval CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 48
49 Fibonacci Numbers Optimal Binary Search Tree All-pairs Shortest Path Computation of Optimal Binary Search Tree CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 49
50 Run Time NP-Complete Problems Fibonacci Numbers Optimal Binary Search Tree All-pairs Shortest Path For each cell of table Consider all possible roots Overall runtime O(N 3 ) CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 50
51 Example NP-Complete Problems Fibonacci Numbers Optimal Binary Search Tree All-pairs Shortest Path CS1102S: Data Structures and Algorithms 11 A: Algorithm Design Techniques 51
2. (a) Explain the strassen s matrix multiplication. (b) Write deletion algorithm, of Binary search tree. [8+8]
Code No: R05220502 Set No. 1 1. (a) Describe the performance analysis in detail. (b) Show that f 1 (n)+f 2 (n) = 0(max(g 1 (n), g 2 (n)) where f 1 (n) = 0(g 1 (n)) and f 2 (n) = 0(g 2 (n)). [8+8] 2. (a)
More informationWhy? A central concept in Computer Science. Algorithms are ubiquitous.
Analysis of Algorithms: A Brief Introduction Why? A central concept in Computer Science. Algorithms are ubiquitous. Using the Internet (sending email, transferring files, use of search engines, online
More informationPage 1. CSCE 310J Data Structures & Algorithms. CSCE 310J Data Structures & Algorithms. P, NP, and NP-Complete. Polynomial-Time Algorithms
CSCE 310J Data Structures & Algorithms P, NP, and NP-Complete Dr. Steve Goddard goddard@cse.unl.edu CSCE 310J Data Structures & Algorithms Giving credit where credit is due:» Most of the lecture notes
More informationCSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) 3 4 4 7 5 9 6 16 7 8 8 4 9 8 10 4 Total 92.
Name: Email ID: CSE 326, Data Structures Section: Sample Final Exam Instructions: The exam is closed book, closed notes. Unless otherwise stated, N denotes the number of elements in the data structure
More informationClosest Pair of Points. Kleinberg and Tardos Section 5.4
Closest Pair of Points Kleinberg and Tardos Section 5.4 Closest Pair of Points Closest pair. Given n points in the plane, find a pair with smallest Euclidean distance between them. Fundamental geometric
More informationClosest Pair Problem
Closest Pair Problem Given n points in d-dimensions, find two whose mutual distance is smallest. Fundamental problem in many applications as well as a key step in many algorithms. p q A naive algorithm
More information1. Nondeterministically guess a solution (called a certificate) 2. Check whether the solution solves the problem (called verification)
Some N P problems Computer scientists have studied many N P problems, that is, problems that can be solved nondeterministically in polynomial time. Traditionally complexity question are studied as languages:
More informationComputer Algorithms. NP-Complete Problems. CISC 4080 Yanjun Li
Computer Algorithms NP-Complete Problems NP-completeness The quest for efficient algorithms is about finding clever ways to bypass the process of exhaustive search, using clues from the input in order
More informationSIMS 255 Foundations of Software Design. Complexity and NP-completeness
SIMS 255 Foundations of Software Design Complexity and NP-completeness Matt Welsh November 29, 2001 mdw@cs.berkeley.edu 1 Outline Complexity of algorithms Space and time complexity ``Big O'' notation Complexity
More informationSection IV.1: Recursive Algorithms and Recursion Trees
Section IV.1: Recursive Algorithms and Recursion Trees Definition IV.1.1: A recursive algorithm is an algorithm that solves a problem by (1) reducing it to an instance of the same problem with smaller
More informationCSC148 Lecture 8. Algorithm Analysis Binary Search Sorting
CSC148 Lecture 8 Algorithm Analysis Binary Search Sorting Algorithm Analysis Recall definition of Big Oh: We say a function f(n) is O(g(n)) if there exists positive constants c,b such that f(n)
More informationCMPSCI611: Approximating MAX-CUT Lecture 20
CMPSCI611: Approximating MAX-CUT Lecture 20 For the next two lectures we ll be seeing examples of approximation algorithms for interesting NP-hard problems. Today we consider MAX-CUT, which we proved to
More informationCS473 - Algorithms I
CS473 - Algorithms I Lecture 4 The Divide-and-Conquer Design Paradigm View in slide-show mode 1 Reminder: Merge Sort Input array A sort this half sort this half Divide Conquer merge two sorted halves Combine
More informationComputational Geometry. Lecture 1: Introduction and Convex Hulls
Lecture 1: Introduction and convex hulls 1 Geometry: points, lines,... Plane (two-dimensional), R 2 Space (three-dimensional), R 3 Space (higher-dimensional), R d A point in the plane, 3-dimensional space,
More informationThe Tower of Hanoi. Recursion Solution. Recursive Function. Time Complexity. Recursive Thinking. Why Recursion? n! = n* (n-1)!
The Tower of Hanoi Recursion Solution recursion recursion recursion Recursive Thinking: ignore everything but the bottom disk. 1 2 Recursive Function Time Complexity Hanoi (n, src, dest, temp): If (n >
More informationSorting revisited. Build the binary search tree: O(n^2) Traverse the binary tree: O(n) Total: O(n^2) + O(n) = O(n^2)
Sorting revisited How did we use a binary search tree to sort an array of elements? Tree Sort Algorithm Given: An array of elements to sort 1. Build a binary search tree out of the elements 2. Traverse
More informationData Structures and Algorithms Written Examination
Data Structures and Algorithms Written Examination 22 February 2013 FIRST NAME STUDENT NUMBER LAST NAME SIGNATURE Instructions for students: Write First Name, Last Name, Student Number and Signature where
More informationDynamic Programming. Lecture 11. 11.1 Overview. 11.2 Introduction
Lecture 11 Dynamic Programming 11.1 Overview Dynamic Programming is a powerful technique that allows one to solve many different types of problems in time O(n 2 ) or O(n 3 ) for which a naive approach
More informationNP-Completeness. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University
NP-Completeness CptS 223 Advanced Data Structures Larry Holder School of Electrical Engineering and Computer Science Washington State University 1 Hard Graph Problems Hard means no known solutions with
More informationTutorial 8. NP-Complete Problems
Tutorial 8 NP-Complete Problems Decision Problem Statement of a decision problem Part 1: instance description defining the input Part 2: question stating the actual yesor-no question A decision problem
More informationGraph Theory Problems and Solutions
raph Theory Problems and Solutions Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles November, 005 Problems. Prove that the sum of the degrees of the vertices of any finite graph is
More informationData Structures Fibonacci Heaps, Amortized Analysis
Chapter 4 Data Structures Fibonacci Heaps, Amortized Analysis Algorithm Theory WS 2012/13 Fabian Kuhn Fibonacci Heaps Lacy merge variant of binomial heaps: Do not merge trees as long as possible Structure:
More informationConverting a Number from Decimal to Binary
Converting a Number from Decimal to Binary Convert nonnegative integer in decimal format (base 10) into equivalent binary number (base 2) Rightmost bit of x Remainder of x after division by two Recursive
More information5.4 Closest Pair of Points
5.4 Closest Pair of Points Closest Pair of Points Closest pair. Given n points in the plane, find a pair with smallest Euclidean distance between them. Fundamental geometric primitive. Graphics, computer
More informationLecture 7: NP-Complete Problems
IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Basic Course on Computational Complexity Lecture 7: NP-Complete Problems David Mix Barrington and Alexis Maciel July 25, 2000 1. Circuit
More informationIE 680 Special Topics in Production Systems: Networks, Routing and Logistics*
IE 680 Special Topics in Production Systems: Networks, Routing and Logistics* Rakesh Nagi Department of Industrial Engineering University at Buffalo (SUNY) *Lecture notes from Network Flows by Ahuja, Magnanti
More informationInternational Journal of Advanced Research in Computer Science and Software Engineering
Volume 3, Issue 7, July 23 ISSN: 2277 28X International Journal of Advanced Research in Computer Science and Software Engineering Research Paper Available online at: www.ijarcsse.com Greedy Algorithm:
More informationComplexity Theory. IE 661: Scheduling Theory Fall 2003 Satyaki Ghosh Dastidar
Complexity Theory IE 661: Scheduling Theory Fall 2003 Satyaki Ghosh Dastidar Outline Goals Computation of Problems Concepts and Definitions Complexity Classes and Problems Polynomial Time Reductions Examples
More informationOutline. NP-completeness. When is a problem easy? When is a problem hard? Today. Euler Circuits
Outline NP-completeness Examples of Easy vs. Hard problems Euler circuit vs. Hamiltonian circuit Shortest Path vs. Longest Path 2-pairs sum vs. general Subset Sum Reducing one problem to another Clique
More informationAPP INVENTOR. Test Review
APP INVENTOR Test Review Main Concepts App Inventor Lists Creating Random Numbers Variables Searching and Sorting Data Linear Search Binary Search Selection Sort Quick Sort Abstraction Modulus Division
More informationVector storage and access; algorithms in GIS. This is lecture 6
Vector storage and access; algorithms in GIS This is lecture 6 Vector data storage and access Vectors are built from points, line and areas. (x,y) Surface: (x,y,z) Vector data access Access to vector
More informationCS473 - Algorithms I
CS473 - Algorithms I Lecture 9 Sorting in Linear Time View in slide-show mode 1 How Fast Can We Sort? The algorithms we have seen so far: Based on comparison of elements We only care about the relative
More informationNP-complete? NP-hard? Some Foundations of Complexity. Prof. Sven Hartmann Clausthal University of Technology Department of Informatics
NP-complete? NP-hard? Some Foundations of Complexity Prof. Sven Hartmann Clausthal University of Technology Department of Informatics Tractability of Problems Some problems are undecidable: no computer
More informationProblem Set 7 Solutions
8 8 Introduction to Algorithms May 7, 2004 Massachusetts Institute of Technology 6.046J/18.410J Professors Erik Demaine and Shafi Goldwasser Handout 25 Problem Set 7 Solutions This problem set is due in
More information5. A full binary tree with n leaves contains [A] n nodes. [B] log n 2 nodes. [C] 2n 1 nodes. [D] n 2 nodes.
1. The advantage of.. is that they solve the problem if sequential storage representation. But disadvantage in that is they are sequential lists. [A] Lists [B] Linked Lists [A] Trees [A] Queues 2. The
More informationIntroduction to Algorithms March 10, 2004 Massachusetts Institute of Technology Professors Erik Demaine and Shafi Goldwasser Quiz 1.
Introduction to Algorithms March 10, 2004 Massachusetts Institute of Technology 6.046J/18.410J Professors Erik Demaine and Shafi Goldwasser Quiz 1 Quiz 1 Do not open this quiz booklet until you are directed
More informationEuclidean Minimum Spanning Trees Based on Well Separated Pair Decompositions Chaojun Li. Advised by: Dave Mount. May 22, 2014
Euclidean Minimum Spanning Trees Based on Well Separated Pair Decompositions Chaojun Li Advised by: Dave Mount May 22, 2014 1 INTRODUCTION In this report we consider the implementation of an efficient
More information28 Closest-Point Problems -------------------------------------------------------------------
28 Closest-Point Problems ------------------------------------------------------------------- Geometric problems involving points on the plane usually involve implicit or explicit treatment of distances
More informationData Structure [Question Bank]
Unit I (Analysis of Algorithms) 1. What are algorithms and how they are useful? 2. Describe the factor on best algorithms depends on? 3. Differentiate: Correct & Incorrect Algorithms? 4. Write short note:
More informationScheduling Shop Scheduling. Tim Nieberg
Scheduling Shop Scheduling Tim Nieberg Shop models: General Introduction Remark: Consider non preemptive problems with regular objectives Notation Shop Problems: m machines, n jobs 1,..., n operations
More informationExam study sheet for CS2711. List of topics
Exam study sheet for CS2711 Here is the list of topics you need to know for the final exam. For each data structure listed below, make sure you can do the following: 1. Give an example of this data structure
More informationTheoretical Computer Science (Bridging Course) Complexity
Theoretical Computer Science (Bridging Course) Complexity Gian Diego Tipaldi A scenario You are a programmer working for a logistics company Your boss asks you to implement a program that optimizes the
More informationAnalysis of Binary Search algorithm and Selection Sort algorithm
Analysis of Binary Search algorithm and Selection Sort algorithm In this section we shall take up two representative problems in computer science, work out the algorithms based on the best strategy to
More informationML for the Working Programmer
ML for the Working Programmer 2nd edition Lawrence C. Paulson University of Cambridge CAMBRIDGE UNIVERSITY PRESS CONTENTS Preface to the Second Edition Preface xiii xv 1 Standard ML 1 Functional Programming
More informationQuestions 1 through 25 are worth 2 points each. Choose one best answer for each.
Questions 1 through 25 are worth 2 points each. Choose one best answer for each. 1. For the singly linked list implementation of the queue, where are the enqueues and dequeues performed? c a. Enqueue in
More informationALGEBRA. sequence, term, nth term, consecutive, rule, relationship, generate, predict, continue increase, decrease finite, infinite
ALGEBRA Pupils should be taught to: Generate and describe sequences As outcomes, Year 7 pupils should, for example: Use, read and write, spelling correctly: sequence, term, nth term, consecutive, rule,
More informationComplexity Classes P and NP
Complexity Classes P and NP MATH 3220 Supplemental Presentation by John Aleshunas The cure for boredom is curiosity. There is no cure for curiosity Dorothy Parker Computational Complexity Theory In computer
More informationThe Classes P and NP
The Classes P and NP We now shift gears slightly and restrict our attention to the examination of two families of problems which are very important to computer scientists. These families constitute the
More informationDiscrete Mathematics Problems
Discrete Mathematics Problems William F. Klostermeyer School of Computing University of North Florida Jacksonville, FL 32224 E-mail: wkloster@unf.edu Contents 0 Preface 3 1 Logic 5 1.1 Basics...............................
More information! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. !-approximation algorithm.
Approximation Algorithms Chapter Approximation Algorithms Q Suppose I need to solve an NP-hard problem What should I do? A Theory says you're unlikely to find a poly-time algorithm Must sacrifice one of
More informationDiscuss the size of the instance for the minimum spanning tree problem.
3.1 Algorithm complexity The algorithms A, B are given. The former has complexity O(n 2 ), the latter O(2 n ), where n is the size of the instance. Let n A 0 be the size of the largest instance that can
More informationMany algorithms, particularly divide and conquer algorithms, have time complexities which are naturally
Recurrence Relations Many algorithms, particularly divide and conquer algorithms, have time complexities which are naturally modeled by recurrence relations. A recurrence relation is an equation which
More informationEE602 Algorithms GEOMETRIC INTERSECTION CHAPTER 27
EE602 Algorithms GEOMETRIC INTERSECTION CHAPTER 27 The Problem Given a set of N objects, do any two intersect? Objects could be lines, rectangles, circles, polygons, or other geometric objects Simple to
More informationV. Adamchik 1. Graph Theory. Victor Adamchik. Fall of 2005
V. Adamchik 1 Graph Theory Victor Adamchik Fall of 2005 Plan 1. Basic Vocabulary 2. Regular graph 3. Connectivity 4. Representing Graphs Introduction A.Aho and J.Ulman acknowledge that Fundamentally, computer
More informationGRAPH THEORY LECTURE 4: TREES
GRAPH THEORY LECTURE 4: TREES Abstract. 3.1 presents some standard characterizations and properties of trees. 3.2 presents several different types of trees. 3.7 develops a counting method based on a bijection
More informationLecture 1: Course overview, circuits, and formulas
Lecture 1: Course overview, circuits, and formulas Topics in Complexity Theory and Pseudorandomness (Spring 2013) Rutgers University Swastik Kopparty Scribes: John Kim, Ben Lund 1 Course Information Swastik
More informationArithmetic Coding: Introduction
Data Compression Arithmetic coding Arithmetic Coding: Introduction Allows using fractional parts of bits!! Used in PPM, JPEG/MPEG (as option), Bzip More time costly than Huffman, but integer implementation
More informationApproximation Algorithms
Approximation Algorithms or: How I Learned to Stop Worrying and Deal with NP-Completeness Ong Jit Sheng, Jonathan (A0073924B) March, 2012 Overview Key Results (I) General techniques: Greedy algorithms
More informationCoNP and Function Problems
CoNP and Function Problems conp By definition, conp is the class of problems whose complement is in NP. NP is the class of problems that have succinct certificates. conp is therefore the class of problems
More informationCAD Algorithms. P and NP
CAD Algorithms The Classes P and NP Mohammad Tehranipoor ECE Department 6 September 2010 1 P and NP P and NP are two families of problems. P is a class which contains all of the problems we solve using
More informationJUST-IN-TIME SCHEDULING WITH PERIODIC TIME SLOTS. Received December May 12, 2003; revised February 5, 2004
Scientiae Mathematicae Japonicae Online, Vol. 10, (2004), 431 437 431 JUST-IN-TIME SCHEDULING WITH PERIODIC TIME SLOTS Ondřej Čepeka and Shao Chin Sung b Received December May 12, 2003; revised February
More informationRandom Map Generator v1.0 User s Guide
Random Map Generator v1.0 User s Guide Jonathan Teutenberg 2003 1 Map Generation Overview...4 1.1 Command Line...4 1.2 Operation Flow...4 2 Map Initialisation...5 2.1 Initialisation Parameters...5 -w xxxxxxx...5
More informationIntroduction to Logic in Computer Science: Autumn 2006
Introduction to Logic in Computer Science: Autumn 2006 Ulle Endriss Institute for Logic, Language and Computation University of Amsterdam Ulle Endriss 1 Plan for Today Now that we have a basic understanding
More informationKrishna Institute of Engineering & Technology, Ghaziabad Department of Computer Application MCA-213 : DATA STRUCTURES USING C
Tutorial#1 Q 1:- Explain the terms data, elementary item, entity, primary key, domain, attribute and information? Also give examples in support of your answer? Q 2:- What is a Data Type? Differentiate
More informationChapter 6: Graph Theory
Chapter 6: Graph Theory Graph theory deals with routing and network problems and if it is possible to find a best route, whether that means the least expensive, least amount of time or the least distance.
More informationChapter 11. 11.1 Load Balancing. Approximation Algorithms. Load Balancing. Load Balancing on 2 Machines. Load Balancing: Greedy Scheduling
Approximation Algorithms Chapter Approximation Algorithms Q. Suppose I need to solve an NP-hard problem. What should I do? A. Theory says you're unlikely to find a poly-time algorithm. Must sacrifice one
More informationSocial Media Mining. Graph Essentials
Graph Essentials Graph Basics Measures Graph and Essentials Metrics 2 2 Nodes and Edges A network is a graph nodes, actors, or vertices (plural of vertex) Connections, edges or ties Edge Node Measures
More informationCS311H. Prof: Peter Stone. Department of Computer Science The University of Texas at Austin
CS311H Prof: Department of Computer Science The University of Texas at Austin Good Morning, Colleagues Good Morning, Colleagues Are there any questions? Logistics Class survey Logistics Class survey Homework
More informationMathematics for Algorithm and System Analysis
Mathematics for Algorithm and System Analysis for students of computer and computational science Edward A. Bender S. Gill Williamson c Edward A. Bender & S. Gill Williamson 2005. All rights reserved. Preface
More informationShortest Path Algorithms
Shortest Path Algorithms Jaehyun Park CS 97SI Stanford University June 29, 2015 Outline Cross Product Convex Hull Problem Sweep Line Algorithm Intersecting Half-planes Notes on Binary/Ternary Search Cross
More informationA binary search tree or BST is a binary tree that is either empty or in which the data element of each node has a key, and:
Binary Search Trees 1 The general binary tree shown in the previous chapter is not terribly useful in practice. The chief use of binary trees is for providing rapid access to data (indexing, if you will)
More informationCPSC 211 Data Structures & Implementations (c) Texas A&M University [ 313]
CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 313] File Structures A file is a collection of data stored on mass storage (e.g., disk or tape) Why on mass storage? too big to fit
More informationThe Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge,
The Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge, cheapest first, we had to determine whether its two endpoints
More information6. Standard Algorithms
6. Standard Algorithms The algorithms we will examine perform Searching and Sorting. 6.1 Searching Algorithms Two algorithms will be studied. These are: 6.1.1. inear Search The inear Search The Binary
More informationHow To Solve A K Path In Time (K)
What s next? Reductions other than kernelization Dániel Marx Humboldt-Universität zu Berlin (with help from Fedor Fomin, Daniel Lokshtanov and Saket Saurabh) WorKer 2010: Workshop on Kernelization Nov
More informationHandout #Ch7 San Skulrattanakulchai Gustavus Adolphus College Dec 6, 2010. Chapter 7: Digraphs
MCS-236: Graph Theory Handout #Ch7 San Skulrattanakulchai Gustavus Adolphus College Dec 6, 2010 Chapter 7: Digraphs Strong Digraphs Definitions. A digraph is an ordered pair (V, E), where V is the set
More informationData Structures. Chapter 8
Chapter 8 Data Structures Computer has to process lots and lots of data. To systematically process those data efficiently, those data are organized as a whole, appropriate for the application, called a
More informationBinary Trees and Huffman Encoding Binary Search Trees
Binary Trees and Huffman Encoding Binary Search Trees Computer Science E119 Harvard Extension School Fall 2012 David G. Sullivan, Ph.D. Motivation: Maintaining a Sorted Collection of Data A data dictionary
More informationIntroduction to Algorithms. Part 3: P, NP Hard Problems
Introduction to Algorithms Part 3: P, NP Hard Problems 1) Polynomial Time: P and NP 2) NP-Completeness 3) Dealing with Hard Problems 4) Lower Bounds 5) Books c Wayne Goddard, Clemson University, 2004 Chapter
More informationDiversity Coloring for Distributed Data Storage in Networks 1
Diversity Coloring for Distributed Data Storage in Networks 1 Anxiao (Andrew) Jiang and Jehoshua Bruck California Institute of Technology Pasadena, CA 9115, U.S.A. {jax, bruck}@paradise.caltech.edu Abstract
More informationBinary Heap Algorithms
CS Data Structures and Algorithms Lecture Slides Wednesday, April 5, 2009 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks CHAPPELLG@member.ams.org 2005 2009 Glenn G. Chappell
More information! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. #-approximation algorithm.
Approximation Algorithms 11 Approximation Algorithms Q Suppose I need to solve an NP-hard problem What should I do? A Theory says you're unlikely to find a poly-time algorithm Must sacrifice one of three
More informationSystem Interconnect Architectures. Goals and Analysis. Network Properties and Routing. Terminology - 2. Terminology - 1
System Interconnect Architectures CSCI 8150 Advanced Computer Architecture Hwang, Chapter 2 Program and Network Properties 2.4 System Interconnect Architectures Direct networks for static connections Indirect
More informationQuery Processing C H A P T E R12. Practice Exercises
C H A P T E R12 Query Processing Practice Exercises 12.1 Assume (for simplicity in this exercise) that only one tuple fits in a block and memory holds at most 3 blocks. Show the runs created on each pass
More informationB490 Mining the Big Data. 2 Clustering
B490 Mining the Big Data 2 Clustering Qin Zhang 1-1 Motivations Group together similar documents/webpages/images/people/proteins/products One of the most important problems in machine learning, pattern
More informationWelcome to... Problem Analysis and Complexity Theory 716.054, 3 VU
Welcome to... Problem Analysis and Complexity Theory 716.054, 3 VU Birgit Vogtenhuber Institute for Software Technology email: bvogt@ist.tugraz.at office hour: Tuesday 10:30 11:30 slides: http://www.ist.tugraz.at/pact.html
More informationNear Optimal Solutions
Near Optimal Solutions Many important optimization problems are lacking efficient solutions. NP-Complete problems unlikely to have polynomial time solutions. Good heuristics important for such problems.
More information340368 - FOPR-I1O23 - Fundamentals of Programming
Coordinating unit: 340 - EPSEVG - Vilanova i la Geltrú School of Engineering Teaching unit: 723 - CS - Department of Computer Science Academic year: Degree: 2015 BACHELOR'S DEGREE IN INFORMATICS ENGINEERING
More informationAlgorithm Design and Analysis
Algorithm Design and Analysis LECTURE 27 Approximation Algorithms Load Balancing Weighted Vertex Cover Reminder: Fill out SRTEs online Don t forget to click submit Sofya Raskhodnikova 12/6/2011 S. Raskhodnikova;
More informationCost Model: Work, Span and Parallelism. 1 The RAM model for sequential computation:
CSE341T 08/31/2015 Lecture 3 Cost Model: Work, Span and Parallelism In this lecture, we will look at how one analyze a parallel program written using Cilk Plus. When we analyze the cost of an algorithm
More informationNotes on Complexity Theory Last updated: August, 2011. Lecture 1
Notes on Complexity Theory Last updated: August, 2011 Jonathan Katz Lecture 1 1 Turing Machines I assume that most students have encountered Turing machines before. (Students who have not may want to look
More informationBinary Search Trees CMPSC 122
Binary Search Trees CMPSC 122 Note: This notes packet has significant overlap with the first set of trees notes I do in CMPSC 360, but goes into much greater depth on turning BSTs into pseudocode than
More informationCSE 4351/5351 Notes 7: Task Scheduling & Load Balancing
CSE / Notes : Task Scheduling & Load Balancing Task Scheduling A task is a (sequential) activity that uses a set of inputs to produce a set of outputs. A task (precedence) graph is an acyclic, directed
More informationThree Effective Top-Down Clustering Algorithms for Location Database Systems
Three Effective Top-Down Clustering Algorithms for Location Database Systems Kwang-Jo Lee and Sung-Bong Yang Department of Computer Science, Yonsei University, Seoul, Republic of Korea {kjlee5435, yang}@cs.yonsei.ac.kr
More informationGuessing Game: NP-Complete?
Guessing Game: NP-Complete? 1. LONGEST-PATH: Given a graph G = (V, E), does there exists a simple path of length at least k edges? YES 2. SHORTEST-PATH: Given a graph G = (V, E), does there exists a simple
More informationP versus NP, and More
1 P versus NP, and More Great Ideas in Theoretical Computer Science Saarland University, Summer 2014 If you have tried to solve a crossword puzzle, you know that it is much harder to solve it than to verify
More information1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++
Answer the following 1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ 2) Which data structure is needed to convert infix notations to postfix notations? Stack 3) The
More informationReductions & NP-completeness as part of Foundations of Computer Science undergraduate course
Reductions & NP-completeness as part of Foundations of Computer Science undergraduate course Alex Angelopoulos, NTUA January 22, 2015 Outline Alex Angelopoulos (NTUA) FoCS: Reductions & NP-completeness-
More information