CSCE 310J Data Structures & Algorithms. Dynamic programming 01 Knapsack problem. Dynamic programming. Dynamic Programming. Knapsack problem (Review)


 Blaise Montgomery
 2 years ago
 Views:
Transcription
1 CSCE J Data Structures & Algorithms Dynamic programming  Knapsac problem Dr. Steve Goddard CSCE J Data Structures & Algorithms Giving credit where credit is due:» Most of slides for this lecture are based on slides created by Dr. David Luebe, University of Virginia.» Some slides are based on lecture notes created by Dr. Chuc Cusac, UNL.» I have modified them and added new slides. Dynamic Programming Another strategy for designing algorithms is dynamic programming» A metatechnique, not an algorithm (lie divide & conquer)» The word programming is historical and predates computer programming Use when problem breas down into recurring small subproblems Dynamic programming It is used when the solution can be recursively described in terms of solutions to subproblems (optimal substructure). Algorithm finds solutions to subproblems and stores them in memory for later use. More efficient than bruteforce methods, which solve the same subproblems over and over again. Summarizing the Concept of Dynamic Programming Basic idea:» Optimal substructure: optimal solution to problem consists of optimal solutions to subproblems» Overlapping subproblems: few subproblems in total, many recurring instances of each» Solve bottomup, building a table of solved subproblems that are used to solve larger ones Variations:» Table could be dimensional, triangular, a tree, etc. Knapsac problem (Review) Given some items, pac the napsac to get the maximum total value. Each item has some weight and some value. Total weight that we can carry is no more than some fixed number W. So we must consider weights of items as well as their value. Item # Weight Value 8 6 6
2 Knapsac problem There are two versions of the problem:.  napsac problem and. Fractional napsac problem. Items are indivisible; you either tae an item or not. Solved with dynamic programming. Items are divisible: you can tae any fraction of an item. Solved with a greedy algorithm. We have already seen this version  Knapsac problem Given a napsac with maximum capacity W, and a set S consisting of n items Each item i has some weight w i and benefit value b i (all w i, b i and W are integer values) Problem: How to pac the napsac to achieve maximum total value of paced items? 8  Knapsac problem: a picture  Knapsac problem This is a napsac Max weight: W = W = Items Weight w i 9 Benefit value b i 8 Problem, in other words, is to find max i T b subject to i i T w W The problem is called a  problem, because each item must be entirely accepted or rejected. In the Fractional Knapsac Problem, we can tae fractions of items. i 9  Knapsac problem: bruteforce approach  Knapsac problem: bruteforce approach Let s first solve this problem with a straightforward algorithm Since there are n items, there are n possible combinations of items. We go through all combinations and find the one with maximum value and with total weight less or equal to W Running time will be O( n ) Can we do better? Yes, with an algorithm based on dynamic programming We need to carefully identify the subproblems Let s try this: If items are labeled..n, then a subproblem would be to find an optimal solution for S = {items labeled,,.. }
3 Defining a Subproblem If items are labeled..n, then a subproblem would be to find an optimal solution for S = {items labeled,,.. } This is a reasonable subproblem definition. The question is: can we describe the final solution (S n ) in terms of subproblems (S )? Unfortunately, we can t do that. Defining a Subproblem w = b = w = b = w = b =8 w = Max weight: W = For S : Total weight: ; Maximum benefit: w = b = w = b = w = b =8 Weight Benefit Item # b = w i b i? w =9 b = For S : Total weight: Maximum benefit: 6 S S 9 8 Solution for S is not part of the solution for S!!! Defining a Subproblem (continued) Recursive Formula for subproblems As we have seen, the solution for S is not part of the solution for S So our definition of a subproblem is flawed and we need another one! Let s add another parameter: w, which will represent the exact weight for each subset of items The subproblem then will be to compute,w] Recursive formula for subproblems:, w] =, w] if w > w max{, w],, w w ] + b } It means, that the best subset of S that has total weight w is: ) the best subset of S  that has total weight w, or ) the best subset of S  that has total weight ww plus the item 6 Recursive Formula, w] =, w] if w > w max{, w],, w w ] + b } The best subset of S that has the total weight w, either contains item or not. First case: w >w. Item can t be part of the solution, since if it was, the total weight would be > w, which is unacceptable. Second case: w w. Then the item can be in the solution, and we choose the case with greater value.  Knapsac Algorithm for w = to W,w] = for i = to n i,] = for i = to n for w = to W if b i + i,ww i ] > i,w] i,w] = b i + i,w w i ] i,w] = i,w] i,w] = i,w] // w i > w 8
4 Running time for w = to W,w] = for i = to n i,] = for i = to n for w = to W < the rest of the code > O(W) Repeat n times O(W) What is the running time of this algorithm? O(n*W) Remember that the bruteforce algorithm taes O( n ) 9 Example Let s run our algorithm on the following data: n = (# of elements) W = (max weight) Elements (weight, benefit): (,), (,), (,), (,6) Example () Example () i\w i\w for w = to W,w] = for i = to n i,] = Example () i\w if b i + i,ww i ] > i,w] i,w] = b i + i,w w i ] i,w] = i,w] i,w] = i,w] // w i > w : (,) : (,) : (,) i= : (,6) b i = w i = w= ww i = Example () i\w if b i + i,ww i ] > i,w] i,w] = b i + i,w w i ] i,w] = i,w] i,w] = i,w] // w i > w : (,) : (,) : (,) i= : (,6) b i = w i = w= ww i =
5 Example (6) i\w if b i + i,ww i ] > i,w] i,w] = b i + i,w w i ] i,w] = i,w] i,w] = i,w] // w i > w : (,) : (,) : (,) i= : (,6) b i = w i = w= ww i = Example () i\w if b i + i,ww i ] > i,w] i,w] = b i + i,w w i ] i,w] = i,w] i,w] = i,w] // w i > w : (,) : (,) : (,) i= : (,6) b i = w i = w= ww i = 6 Example (8) i\w if b i + i,ww i ] > i,w] i,w] = b i + i,w w i ] i,w] = i,w] i,w] = i,w] // w i > w : (,) : (,) : (,) i= : (,6) b i = w i = w= ww i = Example (9) i\w if b i + i,ww i ] > i,w] i,w] = b i + i,w w i ] i,w] = i,w] i,w] = i,w] // w i > w : (,) : (,) : (,) i= : (,6) b i = w i = w= ww i = 8 Example () i\w if b i + i,ww i ] > i,w] i,w] = b i + i,w w i ] i,w] = i,w] i,w] = i,w] // w i > w : (,) : (,) : (,) i= : (,6) b i = w i = w= ww i = Example () i\w if b i + i,ww i ] > i,w] i,w] = b i + i,w w i ] i,w] = i,w] i,w] = i,w] // w i > w : (,) : (,) : (,) i= : (,6) b i = w i = w= ww i = 9
6 Example () i\w if b i + i,ww i ] > i,w] i,w] = b i + i,w w i ] i,w] = i,w] i,w] = i,w] // w i > w : (,) : (,) : (,) i= : (,6) b i = w i = w= ww i = Example () i\w if b i + i,ww i ] > i,w] i,w] = b i + i,w w i ] i,w] = i,w] i,w] = i,w] // w i > w : (,) : (,) : (,) i= : (,6) b i = w i = w= ww i = Example () i\w : (,) : (,) : (,) i= : (,6) b i = w i = w=.. Example () i\w : (,) : (,) : (,) i= : (,6) b i = w i = w= w w i = if b i + i,ww i ] > i,w] i,w] = b i + i,w w i ] i,w] = i,w] i,w] = i,w] // w i > w if b i + i,ww i ] > i,w] i,w] = b i + i,w w i ] i,w] = i,w] i,w] = i,w] // w i > w Example (6) i\w if b i + i,ww i ] > i,w] i,w] = b i + i,w w i ] i,w] = i,w] i,w] = i,w] // w i > w : (,) : (,) : (,) i= : (,6) b i = w i = w= w w i = Example () i\w if b i + i,ww i ] > i,w] i,w] = b i + i,w w i ] i,w] = i,w] i,w] = i,w] // w i > w : (,) : (,) : (,) i= : (,6) b i =6 w i = w=.. 6 6
7 Example (8) i\w if b i + i,ww i ] > i,w] i,w] = b i + i,w w i ] i,w] = i,w] i,w] = i,w] // w i > w : (,) : (,) : (,) i= : (,6) b i =6 w i = w= w w i = Comments This algorithm only finds the max possible value that can be carried in the napsac» I.e., the value in n,w] To now the items that mae this maximum value, an addition to this algorithm is necessary. 8 How to find actual Knapsac Items All of the information we need is in the table. n,w] is the maximal value of items that can be placed in the Knapsac. Let i=n and =W if i,] i,] then mar the i th item as in the napsac i = i, = w i i = i // Assume the i th item is not in the napsac // Could it be in the optimally paced napsac? 9 i\w i= : (,) : (,) : (,) : (,6) = b i =6 w i = i,] = i,] = Finding the Items while i, > if i,] i,] then mar the i th item as in the napsac i = i, = w i i = i i\w i= : (,) : (,) : (,) : (,6) = b i =6 w i = i,] = i,] = Finding the Items () while i, > if i,] i,] then mar the i th item as in the napsac i = i, = w i i = i i\w i= : (,) : (,) : (,) : (,6) = b i =6 w i = i,] = i,] = Finding the Items () while i, > if i,] i,] then mar the i th item as in the napsac i = i, = w i i = i
8 Finding the Items () i\w i= while i, > if i,] i,] then mar the i th item as in the napsac i = i, = w i i = i : (,) : (,) : (,) : (,6) = b i = w i = i,] = i,] = w i = Finding the Items () i\w i= while i, > if i,] i,] then mar the i th item as in the napsac i = i, = w i i = i : (,) : (,) : (,) : (,6) = b i = w i = i,] = i,] = w i = Finding the Items (6) i\w while i, > if i,] i,] then mar the n th item as in the napsac i = i, = w i i = i i= = : (,) : (,) : (,) : (,6) The optimal napsac should contain {, } Finding the Items () i\w while i, > if i,] i,] then mar the n th item as in the napsac i = i, = w i i = i : (,) : (,) : (,) : (,6) The optimal napsac should contain {, } 6 Review: The Knapsac Problem And Optimal Substructure Solving The Knapsac Problem Both variations exhibit optimal substructure To show this for the  problem, consider the most valuable load weighing at most W pounds» If we remove item j from the load, what do we now about the remaining load?» A: remainder must be the most valuable load weighing at most W  w j that thief could tae, excluding item j The optimal solution to the fractional napsac problem can be found with a greedy algorithm» Do you recall how?» Greedy strategy: tae in order of dollars/pound The optimal solution to the  problem cannot be found with the same greedy strategy» Example: items weighing,, and pounds, napsac can hold pounds Suppose item is worth $. Assign values to the other items so that the greedy strategy will fail 8 8
9 The Knapsac Problem: Greedy Vs. Dynamic Memoization The fractional problem can be solved greedily The  problem can be solved with a dynamic programming approach Memoization is another way to deal with overlapping subproblems in dynamic programming» After computing the solution to a subproblem, store it in a table» Subsequent calls just do a table looup With memoization, we implement the algorithm recursively:» If we encounter a subproblem we have seen, we loo up the answer» If not, compute the solution and add it to the list of subproblems we have seen. Must useful when the algorithm is easiest to implement recursively» Especially if we do not need solutions to all subproblems. 9 Conclusion Dynamic programming is a useful technique of solving certain ind of problems When the solution can be recursively described in terms of partial solutions, we can store these partial solutions and reuse them as necessary (memoization) Running time of dynamic programming algorithm vs. naïve algorithm:»  Knapsac problem: O(W*n) vs. O( n ) 9
The Greedy Method. Fundamental Techniques. The Greedy Method. Fractional Knapsack Problem
Fundamental Techniques There are some algorithmic tools that are quite specialised. They are good for problems they are intended to solve, but they are not very versatile. There are also more fundamental
More informationLecture 13: The Knapsack Problem
Lecture 13: The Knapsack Problem Outline of this Lecture Introduction of the 01 Knapsack Problem. A dynamic programming solution to this problem. 1 01 Knapsack Problem Informal Description: We have computed
More informationAnalysis of Algorithms I: Optimal Binary Search Trees
Analysis of Algorithms I: Optimal Binary Search Trees Xi Chen Columbia University Given a set of n keys K = {k 1,..., k n } in sorted order: k 1 < k 2 < < k n we wish to build an optimal binary search
More informationBig Data & Scripting Part II Streaming Algorithms
Big Data & Scripting Part II Streaming Algorithms 1, 2, a note on sampling and filtering sampling: (randomly) choose a representative subset filtering: given some criterion (e.g. membership in a set),
More informationMemoization/Dynamic Programming. The String reconstruction problem. CS125 Lecture 5 Fall 2016
CS125 Lecture 5 Fall 2016 Memoization/Dynamic Programming Today s lecture discusses memoization, which is a method for speeding up algorithms based on recursion, by using additional memory to remember
More informationNear Optimal Solutions
Near Optimal Solutions Many important optimization problems are lacking efficient solutions. NPComplete problems unlikely to have polynomial time solutions. Good heuristics important for such problems.
More informationPage 1. CSCE 310J Data Structures & Algorithms. CSCE 310J Data Structures & Algorithms. P, NP, and NPComplete. PolynomialTime Algorithms
CSCE 310J Data Structures & Algorithms P, NP, and NPComplete Dr. Steve Goddard goddard@cse.unl.edu CSCE 310J Data Structures & Algorithms Giving credit where credit is due:» Most of the lecture notes
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 informationThe Selection Problem
The Selection Problem The selection problem: given an integer k and a list x 1,..., x n of n elements find the kth smallest element in the list Example: the 3rd smallest element of the following list
More informationLecture 7: NPComplete Problems
IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Basic Course on Computational Complexity Lecture 7: NPComplete Problems David Mix Barrington and Alexis Maciel July 25, 2000 1. Circuit
More informationIntroduction to Algorithms Review information for Prelim 1 CS 4820, Spring 2010 Distributed Wednesday, February 24
Introduction to Algorithms Review information for Prelim 1 CS 4820, Spring 2010 Distributed Wednesday, February 24 The final exam will cover seven topics. 1. greedy algorithms 2. divideandconquer algorithms
More informationCOMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012
Binary numbers The reason humans represent numbers using decimal (the ten digits from 0,1,... 9) is that we have ten fingers. There is no other reason than that. There is nothing special otherwise about
More informationRecurrence Relations
Recurrence Relations Introduction Determining the running time of a recursive algorithm often requires one to determine the bigo growth of a function T (n) that is defined in terms of a recurrence relation.
More informationTheorem (The division theorem) Suppose that a and b are integers with b > 0. There exist unique integers q and r so that. a = bq + r and 0 r < b.
Theorem (The division theorem) Suppose that a and b are integers with b > 0. There exist unique integers q and r so that a = bq + r and 0 r < b. We re dividing a by b: q is the quotient and r is the remainder,
More informationSolutions to Homework 6
Solutions to Homework 6 Debasish Das EECS Department, Northwestern University ddas@northwestern.edu 1 Problem 5.24 We want to find light spanning trees with certain special properties. Given is one example
More informationLecture 10: Regression Trees
Lecture 10: Regression Trees 36350: Data Mining October 11, 2006 Reading: Textbook, sections 5.2 and 10.5. The next three lectures are going to be about a particular kind of nonlinear predictive model,
More informationWeek 7: Divide and Conquer
Agenda: Divide and Conquer technique Multiplication of large integers Exponentiation Matrix multiplication 1 2 Divide and Conquer : To solve a problem we can break it into smaller subproblems, solve each
More informationDynamic Programming Problem Set Partial Solution CMPSC 465
Dynamic Programming Problem Set Partial Solution CMPSC 465 I ve annotated this document with partial solutions to problems written more like a test solution. (I remind you again, though, that a formal
More informationRecall that in base 10, the digits of a number are just coefficients of powers of the base (10):
Binary Number System 1 Base 10 digits: 0 1 2 3 4 5 6 7 8 9 Base 2 digits: 0 1 Recall that in base 10, the digits of a number are just coefficients of powers of the base (10): 417 = 4 * 10 2 + 1 * 10 1
More informationDivide And Conquer Algorithms
CSE341T/CSE549T 09/10/2014 Lecture 5 Divide And Conquer Algorithms Recall in last lecture, we looked at one way of parallelizing matrix multiplication. At the end of the lecture, we saw the reduce SUM
More informationDynamic programming. Doctoral course Optimization on graphs  Lecture 4.1. Giovanni Righini. January 17 th, 2013
Dynamic programming Doctoral course Optimization on graphs  Lecture.1 Giovanni Righini January 1 th, 201 Implicit enumeration Combinatorial optimization problems are in general NPhard and we usually
More informationBinary Number System. 16. Binary Numbers. Base 10 digits: 0 1 2 3 4 5 6 7 8 9. Base 2 digits: 0 1
Binary Number System 1 Base 10 digits: 0 1 2 3 4 5 6 7 8 9 Base 2 digits: 0 1 Recall that in base 10, the digits of a number are just coefficients of powers of the base (10): 417 = 4 * 10 2 + 1 * 10 1
More information1 Recursion and the divideandconquer approach
CS 7B  Spring 2014  Assignment 4. 4/17/14 Write responses on paper and submit programs by email. 1 Recursion and the divideandconquer approach Many useful algorithms are recursive in structure: to
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 informationDivide and Conquer My T. UF
Introduction to Algorithms Divide and Conquer @ UF General Approach Divide the problem into a number of subproblems that are smaller instances of the same problem Conquer the subproblems by solving them
More informationInformation Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay
Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay Lecture  17 ShannonFanoElias Coding and Introduction to Arithmetic Coding
More informationData Mining Cluster Analysis: Basic Concepts and Algorithms. Lecture Notes for Chapter 8. Introduction to Data Mining
Data Mining Cluster Analysis: Basic Concepts and Algorithms Lecture Notes for Chapter 8 by Tan, Steinbach, Kumar 1 What is Cluster Analysis? Finding groups of objects such that the objects in a group will
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 informationComputer Science 211 Data Structures Mount Holyoke College Fall Topic Notes: Recursion and Mathematical Induction
Computer Science 11 Data Structures Mount Holyoke College Fall 009 Topic Notes: Recursion and Mathematical Induction Recursion An important tool when trying to solve a problem is the ability to break the
More informationINTEGER PROGRAMMING. Integer Programming. Prototype example. BIP model. BIP models
Integer Programming INTEGER PROGRAMMING In many problems the decision variables must have integer values. Example: assign people, machines, and vehicles to activities in integer quantities. If this is
More informationMA 1125 Lecture 14  Expected Values. Friday, February 28, 2014. Objectives: Introduce expected values.
MA 5 Lecture 4  Expected Values Friday, February 2, 24. Objectives: Introduce expected values.. Means, Variances, and Standard Deviations of Probability Distributions Two classes ago, we computed the
More informationIntro. to the DivideandConquer Strategy via Merge Sort CMPSC 465 CLRS Sections 2.3, Intro. to and various parts of Chapter 4
Intro. to the DivideandConquer Strategy via Merge Sort CMPSC 465 CLRS Sections 2.3, Intro. to and various parts of Chapter 4 I. Algorithm Design and DivideandConquer There are various strategies we
More informationOutline. NPcompleteness. When is a problem easy? When is a problem hard? Today. Euler Circuits
Outline NPcompleteness Examples of Easy vs. Hard problems Euler circuit vs. Hamiltonian circuit Shortest Path vs. Longest Path 2pairs sum vs. general Subset Sum Reducing one problem to another Clique
More informationAbout the inverse football pool problem for 9 games 1
Seventh International Workshop on Optimal Codes and Related Topics September 61, 013, Albena, Bulgaria pp. 15133 About the inverse football pool problem for 9 games 1 Emil Kolev Tsonka Baicheva Institute
More informationComputer Algorithms. NPComplete Problems. CISC 4080 Yanjun Li
Computer Algorithms NPComplete Problems NPcompleteness 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 informationRecurrences (CLRS )
Recurrences (CLRS 4.14.2) Last time we discussed divideandconquer algorithms Divide and Conquer To Solve P: 1. Divide P into smaller problems P 1,P 2,P 3...P k. 2. Conquer by solving the (smaller) subproblems
More informationFaster deterministic integer factorisation
David Harvey (joint work with Edgar Costa, NYU) University of New South Wales 25th October 2011 The obvious mathematical breakthrough would be the development of an easy way to factor large prime numbers
More informationLecture 12: Chain Matrix Multiplication
Lecture 12: Chain Matrix Multiplication CLRS Section 15.2 Outline of this Lecture Recalling matrix multiplication. The chain matrix multiplication problem. A dynamic programming algorithm for chain matrix
More informationInduction. Margaret M. Fleck. 10 October These notes cover mathematical induction and recursive definition
Induction Margaret M. Fleck 10 October 011 These notes cover mathematical induction and recursive definition 1 Introduction to induction At the start of the term, we saw the following formula for computing
More informationFinal Exam, Spring 2007
10701 Final Exam, Spring 2007 1. Personal info: Name: Andrew account: Email address: 2. There should be 16 numbered pages in this exam (including this cover sheet). 3. You can use any material you brought:
More informationData Preprocessing. Week 2
Data Preprocessing Week 2 Topics Data Types Data Repositories Data Preprocessing Present homework assignment #1 Team Homework Assignment #2 Read pp. 227 240, pp. 250 250, and pp. 259 263 the text book.
More informationCS420/520 Algorithm Analysis Spring 2010 Lecture 04
CS420/520 Algorithm Analysis Spring 2010 Lecture 04 I. Chapter 4 Recurrences A. Introduction 1. Three steps applied at each level of a recursion a) Divide into a number of subproblems that are smaller
More informationDesign and Analysis of Algorithms
Design and Analysis of Algorithms CSE 5311 Lecture 3 DivideandConquer Junzhou Huang, Ph.D. Department of Computer Science and Engineering CSE5311 Design and Analysis of Algorithms 1 Reviewing: Θnotation
More informationLecture 21: Dynamic Programming III
Lecture 21: Dynamic Programming III Lecture Overview Subproblems for strings Parenthesization Edit distance (& longest common subseq.) Knapsack Pseudopolynomial Time Review: * 5 easy steps to dynamic programming
More informationGreedy algorithms. Solve the Fractional Knapsack Problem for this set of items, where the maximum total allowed weight is W max = 15.
Greedy algorithms 1. Consider the set of items S = {a, b, c, d, e, f, g, h} where the benefits and weights are given in the table below. Note that I have computed the value index of each item (benefit/weight)
More informationThe Tower of Hanoi. Recursion Solution. Recursive Function. Time Complexity. Recursive Thinking. Why Recursion? n! = n* (n1)!
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 informationNotes on Excel Forecasting Tools. Data Table, Scenario Manager, Goal Seek, & Solver
Notes on Excel Forecasting Tools Data Table, Scenario Manager, Goal Seek, & Solver 20012002 1 Contents Overview...1 Data Table Scenario Manager Goal Seek Solver Examples Data Table...2 Scenario Manager...8
More informationInduction Problems. Tom Davis November 7, 2005
Induction Problems Tom Davis tomrdavis@earthlin.net http://www.geometer.org/mathcircles November 7, 2005 All of the following problems should be proved by mathematical induction. The problems are not necessarily
More information3.2 The Factor Theorem and The Remainder Theorem
3. The Factor Theorem and The Remainder Theorem 57 3. The Factor Theorem and The Remainder Theorem Suppose we wish to find the zeros of f(x) = x 3 + 4x 5x 4. Setting f(x) = 0 results in the polynomial
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 information8.1 Makespan Scheduling
600.469 / 600.669 Approximation Algorithms Lecturer: Michael Dinitz Topic: Dynamic Programing: MinMakespan and Bin Packing Date: 2/19/15 Scribe: Gabriel Kaptchuk 8.1 Makespan Scheduling Consider an instance
More informationBinary Ant Colony Evolutionary Algorithm
Weiqing Xiong Liuyi Wang Chenyang Yan School of Information Science and Engineering Ningbo University, Ningbo 35 China Weiqing,xwqdds@tom.com, Liuyi,jameswang@hotmail.com School Information and Electrical
More informationData Mining Classification: Decision Trees
Data Mining Classification: Decision Trees Classification Decision Trees: what they are and how they work Hunt s (TDIDT) algorithm How to select the best split How to handle Inconsistent data Continuous
More informationMerge Sort and Recurrences. COSC 581, Algorithms January 14, 2014
Merge Sort and Recurrences COSC 581, Algorithms January 14, 2014 Reading Assignments Today s class: Chapter 2, 4.0, 4.4 Reading assignment for next class: Chapter 4.2, 4.5 3 Common Algorithmic Techniques
More information// Returns base ^ exponent. // Precondition: exponent >= 0 // base case; any number to 0th power is 1 // recursive case: x^n = x * x^(n1)
Recursion continued Exercise solution // Returns base ^ exponent. // Precondition: exponent >= 0 public static int pow(int x, int n) { if (n == 0) { // base case; any number to 0th power is 1 return 1;
More informationData Mining Classification: Basic Concepts, Decision Trees, and Model Evaluation. Lecture Notes for Chapter 4. Introduction to Data Mining
Data Mining Classification: Basic Concepts, Decision Trees, and Model Evaluation Lecture Notes for Chapter 4 Introduction to Data Mining by Tan, Steinbach, Kumar Tan,Steinbach, Kumar Introduction to Data
More informationUseful Number Systems
Useful Number Systems Decimal Base = 10 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} Binary Base = 2 Digit Set = {0, 1} Octal Base = 8 = 2 3 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7} Hexadecimal Base = 16 = 2
More informationNotes on Factoring. MA 206 Kurt Bryan
The General Approach Notes on Factoring MA 26 Kurt Bryan Suppose I hand you n, a 2 digit integer and tell you that n is composite, with smallest prime factor around 5 digits. Finding a nontrivial factor
More informationCSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis. Linda Shapiro Winter 2015
CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis Linda Shapiro Today Registration should be done. Homework 1 due 11:59 pm next Wednesday, January 14 Review math essential
More informationPolynomials. Dr. philippe B. laval Kennesaw State University. April 3, 2005
Polynomials Dr. philippe B. laval Kennesaw State University April 3, 2005 Abstract Handout on polynomials. The following topics are covered: Polynomial Functions End behavior Extrema Polynomial Division
More informationCSC2420 Spring 2015: Lecture 3
CSC2420 Spring 2015: Lecture 3 Allan Borodin January 22, 2015 1 / 1 Announcements and todays agenda Assignment 1 due next Thursday. I may add one or two additional questions today or tomorrow. Todays agenda
More informationThe Taxman Game. Robert K. Moniot September 5, 2003
The Taxman Game Robert K. Moniot September 5, 2003 1 Introduction Want to know how to beat the taxman? Legally, that is? Read on, and we will explore this cute little mathematical game. The taxman game
More informationSolving Mixed Integer Linear Programs Using Branch and Cut Algorithm
1 Solving Mixed Integer Linear Programs Using Branch and Cut Algorithm by Shon Albert A Project Submitted to the Graduate Faculty of North Carolina State University in Partial Fulfillment of the Requirements
More informationApproximation Algorithms
Approximation Algorithms or: How I Learned to Stop Worrying and Deal with NPCompleteness Ong Jit Sheng, Jonathan (A0073924B) March, 2012 Overview Key Results (I) General techniques: Greedy algorithms
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 information1 Simulating Brownian motion (BM) and geometric Brownian motion (GBM)
Copyright c 2013 by Karl Sigman 1 Simulating Brownian motion (BM) and geometric Brownian motion (GBM) For an introduction to how one can construct BM, see the Appendix at the end of these notes A stochastic
More information24. The Branch and Bound Method
24. The Branch and Bound Method It has serious practical consequences if it is known that a combinatorial problem is NPcomplete. Then one can conclude according to the present state of science that no
More informationPROJECT COST MANAGEMENT
7 PROJECT COST MANAGEMENT Project Cost Management includes the processes required to ensure that the project is completed within the approved budget. Figure 7 1 provides an overview of the following major
More informationLecture Notes on Database Normalization
Lecture Notes on Database Normalization Chengkai Li Department of Computer Science and Engineering The University of Texas at Arlington April 15, 2012 I decided to write this document, because many students
More informationStats for Strategy Exam 1 InClass Practice Questions DIRECTIONS
Stats for Strategy Exam 1 InClass Practice Questions DIRECTIONS Choose the single best answer for each question. Discuss questions with classmates, TAs and Professor Whitten. Raise your hand to check
More informationData Mining with R. Decision Trees and Random Forests. Hugh Murrell
Data Mining with R Decision Trees and Random Forests Hugh Murrell reference books These slides are based on a book by Graham Williams: Data Mining with Rattle and R, The Art of Excavating Data for Knowledge
More informationCSI 333 Lecture 1 Number Systems
CSI 333 Lecture 1 Number Systems 1 1 / 23 Basics of Number Systems Ref: Appendix C of Deitel & Deitel. Weighted Positional Notation: 192 = 2 10 0 + 9 10 1 + 1 10 2 General: Digit sequence : d n 1 d n 2...
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 information2 The Euclidean algorithm
2 The Euclidean algorithm Do you understand the number 5? 6? 7? At some point our level of comfort with individual numbers goes down as the numbers get large For some it may be at 43, for others, 4 In
More informationLess naive Bayes spam detection
Less naive Bayes spam detection Hongming Yang Eindhoven University of Technology Dept. EE, Rm PT 3.27, P.O.Box 53, 5600MB Eindhoven The Netherlands. Email:h.m.yang@tue.nl also CoSiNe Connectivity Systems
More informationTemperature Scales. The metric system that we are now using includes a unit that is specific for the representation of measured temperatures.
Temperature Scales INTRODUCTION The metric system that we are now using includes a unit that is specific for the representation of measured temperatures. The unit of temperature in the metric system is
More informationMedical Information Management & Mining. You Chen Jan,15, 2013 You.chen@vanderbilt.edu
Medical Information Management & Mining You Chen Jan,15, 2013 You.chen@vanderbilt.edu 1 Trees Building Materials Trees cannot be used to build a house directly. How can we transform trees to building materials?
More informationAnnuities. Lecture: Weeks 911. Lecture: Weeks 911 (STT 455) Annuities Fall 2014  Valdez 1 / 43
Annuities Lecture: Weeks 911 Lecture: Weeks 911 (STT 455) Annuities Fall 2014  Valdez 1 / 43 What are annuities? What are annuities? An annuity is a series of payments that could vary according to:
More informationMapReduce and Distributed Data Analysis. Sergei Vassilvitskii Google Research
MapReduce and Distributed Data Analysis Google Research 1 Dealing With Massive Data 2 2 Dealing With Massive Data Polynomial Memory Sublinear RAM Sketches External Memory Property Testing 3 3 Dealing With
More informationAssignment Problems. Guoming Tang
Assignment Problems Guoming Tang A Practical Problem Workers: A, B, C, D Jobs: P, Q, R, S. Cost matrix: Job P Job Q Job R Job S Worker A 1 2 3 4 Worker B 2 4 6 8 Worker C 3 6 9 12 Worker D 4 8 12 16 Given:
More informationDivide and Conquer Examples. Topdown recursive mergesort. Gravitational Nbody problem.
Divide and Conquer Divide the problem into several subproblems of equal size. Recursively solve each subproblem in parallel. Merge the solutions to the various subproblems into a solution for the original
More informationComputational Finance Options
1 Options 1 1 Options Computational Finance Options An option gives the holder of the option the right, but not the obligation to do something. Conversely, if you sell an option, you may be obliged to
More information!"!!"#$$%&'()*+$(,%!"#$%$&'()*""%(+,'*&./#$&'(&(0*".$#$1"(2&."3$'45"
!"!!"#$$%&'()*+$(,%!"#$%$&'()*""%(+,'*&./#$&'(&(0*".$#$1"(2&."3$'45"!"#"$%&#'()*+',$$.&#',/"0%.12'32./4'5,5'6/%&)$).2&'7./&)8'5,5'9/2%.%3%&8':")08';:
More informationExponential time algorithms for graph coloring
Exponential time algorithms for graph coloring Uriel Feige Lecture notes, March 14, 2011 1 Introduction Let [n] denote the set {1,..., k}. A klabeling of vertices of a graph G(V, E) is a function V [k].
More informationFormal Languages and Automata Theory  Regular Expressions and Finite Automata 
Formal Languages and Automata Theory  Regular Expressions and Finite Automata  Samarjit Chakraborty Computer Engineering and Networks Laboratory Swiss Federal Institute of Technology (ETH) Zürich March
More informationGame Theory and Algorithms Lecture 10: Extensive Games: Critiques and Extensions
Game Theory and Algorithms Lecture 0: Extensive Games: Critiques and Extensions March 3, 0 Summary: We discuss a game called the centipede game, a simple extensive game where the prediction made by backwards
More informationCSC 373: Algorithm Design and Analysis Lecture 16
CSC 373: Algorithm Design and Analysis Lecture 16 Allan Borodin February 25, 2013 Some materials are from Stephen Cook s IIT talk and Keven Wayne s slides. 1 / 17 Announcements and Outline Announcements
More informationSOLUTIONS FOR PROBLEM SET 2
SOLUTIONS FOR PROBLEM SET 2 A: There exist primes p such that p+6k is also prime for k = 1,2 and 3. One such prime is p = 11. Another such prime is p = 41. Prove that there exists exactly one prime p such
More informationChapter 4. Trees. 4.1 Basics
Chapter 4 Trees 4.1 Basics A tree is a connected graph with no cycles. A forest is a collection of trees. A vertex of degree one, particularly in a tree, is called a leaf. Trees arise in a variety of applications.
More informationOptimal Cheque Production: A Case Study
Blo UNIVERSITÀ DI SALERNO Dipartimento di Matematica e Informatica D.M.I. Via Ponte don Melillo 84084 Fisciano (SA) Italy Optimal Cheque Production: A Case Study Raffaele Cerulli, Renato De Leone, Monica
More informationSolutions of Linear Equations in One Variable
2. Solutions of Linear Equations in One Variable 2. OBJECTIVES. Identify a linear equation 2. Combine like terms to solve an equation We begin this chapter by considering one of the most important tools
More informationLanguage Modeling. Chapter 1. 1.1 Introduction
Chapter 1 Language Modeling (Course notes for NLP by Michael Collins, Columbia University) 1.1 Introduction In this chapter we will consider the the problem of constructing a language model from a set
More informationSupervised Learning (Big Data Analytics)
Supervised Learning (Big Data Analytics) Vibhav Gogate Department of Computer Science The University of Texas at Dallas Practical advice Goal of Big Data Analytics Uncover patterns in Data. Can be used
More informationIP Subnetting: Practical Subnet Design and Address Determination Example
IP Subnetting: Practical Subnet Design and Address Determination Example When educators ask students what they consider to be the most confusing aspect in learning about networking, many say that it is
More information! Solve problem to optimality. ! Solve problem in polytime. ! Solve arbitrary instances of the problem. #approximation algorithm.
Approximation Algorithms 11 Approximation Algorithms Q Suppose I need to solve an NPhard problem What should I do? A Theory says you're unlikely to find a polytime algorithm Must sacrifice one of three
More informationProject and Production Management Prof. Arun Kanda Department of Mechanical Engineering Indian Institute of Technology, Delhi
Project and Production Management Prof. Arun Kanda Department of Mechanical Engineering Indian Institute of Technology, Delhi Lecture  9 Basic Scheduling with AOA Networks Today we are going to be talking
More informationDimitris Chatzidimitriou. Corelab NTUA. June 28, 2013
AN EFFICIENT ALGORITHM FOR THE OPTIMAL STABLE MARRIAGE PROBLEM Dimitris Chatzidimitriou Corelab NTUA June 28, 2013 OUTLINE 1 BASIC CONCEPTS 2 DEFINITIONS 3 ROTATIONS 4 THE ALGORITHM DIMITRIS CHATZIDIMITRIOU
More informationChapter 13: Binary and MixedInteger Programming
Chapter 3: Binary and MixedInteger Programming The general branch and bound approach described in the previous chapter can be customized for special situations. This chapter addresses two special situations:
More informationSlope Investigation. Grade 8, Algebra 1, or Math 1 in a unit with rate of change and slope
NATIONAL MATH + SCIENCE INITIATIVE Mathematics Slope Investigation LEVEL Grade 8, Algebra 1, or Math 1 in a unit with rate of change and slope MODULE/CONNECTION TO AP* Rate of Change *Advanced Placement
More informationChapter 20: Data Analysis
Chapter 20: Data Analysis Database System Concepts, 6 th Ed. See www.dbbook.com for conditions on reuse Chapter 20: Data Analysis Decision Support Systems Data Warehousing Data Mining Classification
More information