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

Size: px
Start display at page:

Download "CSCE 310J Data Structures & Algorithms. Dynamic programming 0-1 Knapsack problem. Dynamic programming. Dynamic Programming. Knapsack problem (Review)"

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 brute-force 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 bottom-up, 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: brute-force approach - Knapsac problem: brute-force 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 w-w 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-,w-w 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 brute-force 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-,w-w 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-,w-w 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 =

5 Example (6) i\w if b i + i-,w-w 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-,w-w 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 = 6 Example (8) i\w if b i + i-,w-w 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 (9) i\w if b i + i-,w-w 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 =- 8 Example () i\w if b i + i-,w-w 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-,w-w 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 = 9

6 Example () i\w if b i + i-,w-w 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-,w-w 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 : (,) : (,) : (,) i= : (,6) b i = w i = w=.. Example () i\w : (,) : (,) : (,) i= : (,6) b i = w i = w= w- w i = if b i + i-,w-w 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-,w-w 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-,w-w 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-,w-w 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-,w-w 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 re-use them as necessary (memoization) Running time of dynamic programming algorithm vs. naïve algorithm:» - Knapsac problem: O(W*n) vs. O( n ) 9

Lecture 13: The Knapsack Problem

Lecture 13: The Knapsack Problem Lecture 13: The Knapsack Problem Outline of this Lecture Introduction of the 0-1 Knapsack Problem. A dynamic programming solution to this problem. 1 0-1 Knapsack Problem Informal Description: We have computed

More information

Analysis of Algorithms I: Optimal Binary Search Trees

Analysis 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 information

Big Data & Scripting Part II Streaming Algorithms

Big 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 information

Page 1. CSCE 310J Data Structures & Algorithms. CSCE 310J Data Structures & Algorithms. P, NP, and NP-Complete. Polynomial-Time Algorithms

Page 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 information

Near Optimal Solutions

Near 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 information

Dynamic Programming. Lecture 11. 11.1 Overview. 11.2 Introduction

Dynamic 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 information

Lecture 7: NP-Complete Problems

Lecture 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 information

Solutions to Homework 6

Solutions 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 information

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

COMP 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 information

Lecture 10: Regression Trees

Lecture 10: Regression Trees Lecture 10: Regression Trees 36-350: 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 information

Week 7: Divide and Conquer

Week 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 information

Dynamic Programming Problem Set Partial Solution CMPSC 465

Dynamic 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 information

Dynamic programming. Doctoral course Optimization on graphs - Lecture 4.1. Giovanni Righini. January 17 th, 2013

Dynamic 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 NP-hard and we usually

More information

Binary 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. 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 information

Information 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 Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay Lecture - 17 Shannon-Fano-Elias Coding and Introduction to Arithmetic Coding

More information

Euclidean 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 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 information

Data 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. 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 information

Data Structures and Algorithms Written Examination

Data 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 information

INTEGER PROGRAMMING. Integer Programming. Prototype example. BIP model. BIP models

INTEGER 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 information

MA 1125 Lecture 14 - Expected Values. Friday, February 28, 2014. Objectives: Introduce expected values.

MA 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 information

Outline. NP-completeness. When is a problem easy? When is a problem hard? Today. Euler Circuits

Outline. 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 information

About the inverse football pool problem for 9 games 1

About the inverse football pool problem for 9 games 1 Seventh International Workshop on Optimal Codes and Related Topics September 6-1, 013, Albena, Bulgaria pp. 15-133 About the inverse football pool problem for 9 games 1 Emil Kolev Tsonka Baicheva Institute

More information

Computer Algorithms. NP-Complete Problems. CISC 4080 Yanjun Li

Computer 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 information

Data Preprocessing. Week 2

Data 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 information

Faster deterministic integer factorisation

Faster 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 information

Lecture 12: Chain Matrix Multiplication

Lecture 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 information

Notes on Excel Forecasting Tools. Data Table, Scenario Manager, Goal Seek, & Solver

Notes on Excel Forecasting Tools. Data Table, Scenario Manager, Goal Seek, & Solver Notes on Excel Forecasting Tools Data Table, Scenario Manager, Goal Seek, & Solver 2001-2002 1 Contents Overview...1 Data Table Scenario Manager Goal Seek Solver Examples Data Table...2 Scenario Manager...8

More information

The Tower of Hanoi. Recursion Solution. Recursive Function. Time Complexity. Recursive Thinking. Why Recursion? n! = n* (n-1)!

The 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 information

Induction Problems. Tom Davis November 7, 2005

Induction 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 information

3.2 The Factor Theorem and The Remainder Theorem

3.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 information

Binary Ant Colony Evolutionary Algorithm

Binary 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 information

Lecture 1: Course overview, circuits, and formulas

Lecture 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 information

Data Mining Classification: Decision Trees

Data 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 information

Notes on Factoring. MA 206 Kurt Bryan

Notes 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 information

CSE373: 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 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 information

Data 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 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 information

CSC2420 Spring 2015: Lecture 3

CSC2420 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 information

Polynomials. Dr. philippe B. laval Kennesaw State University. April 3, 2005

Polynomials. 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 information

PROJECT COST MANAGEMENT

PROJECT 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 information

Approximation Algorithms

Approximation 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 information

1 Simulating Brownian motion (BM) and geometric Brownian motion (GBM)

1 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 information

Decision-Tree Learning

Decision-Tree Learning Decision-Tree Learning Introduction ID3 Attribute selection Entropy, Information, Information Gain Gain Ratio C4.5 Decision Trees TDIDT: Top-Down Induction of Decision Trees Numeric Values Missing Values

More information

Useful Number Systems

Useful 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 information

Discuss the size of the instance for the minimum spanning tree problem.

Discuss 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 information

The Taxman Game. Robert K. Moniot September 5, 2003

The 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 information

Lecture Notes on Database Normalization

Lecture 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 information

Algorithm Design and Analysis

Algorithm 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 information

Data Mining with R. Decision Trees and Random Forests. Hugh Murrell

Data 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 information

Less naive Bayes spam detection

Less 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. E-mail:h.m.yang@tue.nl also CoSiNe Connectivity Systems

More information

Computational Finance Options

Computational 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

CSI 333 Lecture 1 Number Systems

CSI 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 information

Security-Aware Beacon Based Network Monitoring

Security-Aware Beacon Based Network Monitoring Security-Aware Beacon Based Network Monitoring Masahiro Sasaki, Liang Zhao, Hiroshi Nagamochi Graduate School of Informatics, Kyoto University, Kyoto, Japan Email: {sasaki, liang, nag}@amp.i.kyoto-u.ac.jp

More information

Stats for Strategy Exam 1 In-Class Practice Questions DIRECTIONS

Stats for Strategy Exam 1 In-Class Practice Questions DIRECTIONS Stats for Strategy Exam 1 In-Class 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 information

MapReduce and Distributed Data Analysis. Sergei Vassilvitskii Google Research

MapReduce 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 information

Medical 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 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 information

Annuities. Lecture: Weeks 9-11. Lecture: Weeks 9-11 (STT 455) Annuities Fall 2014 - Valdez 1 / 43

Annuities. Lecture: Weeks 9-11. Lecture: Weeks 9-11 (STT 455) Annuities Fall 2014 - Valdez 1 / 43 Annuities Lecture: Weeks 9-11 Lecture: Weeks 9-11 (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 information

!"!!"#$$%&'()*+$(,%!"#$%$&'()*""%(+,'-*&./#-$&'(-&(0*".$#-$1"(2&."3$'45"

!!!#$$%&'()*+$(,%!#$%$&'()*%(+,'-*&./#-$&'(-&(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 information

CSC 373: Algorithm Design and Analysis Lecture 16

CSC 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 information

Divide and Conquer Examples. Top-down recursive mergesort. Gravitational N-body problem.

Divide and Conquer Examples. Top-down recursive mergesort. Gravitational N-body 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 information

Exponential time algorithms for graph coloring

Exponential 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 k-labeling of vertices of a graph G(V, E) is a function V [k].

More information

Temperature Scales. The metric system that we are now using includes a unit that is specific for the representation of measured temperatures.

Temperature 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 information

Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

Formal 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 information

Project 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 Project and Production Management Prof. Arun Kanda Department of Mechanical Engineering Indian Institute of Technology, Delhi Lecture - 9 Basic Scheduling with A-O-A Networks Today we are going to be talking

More information

SOLUTIONS FOR PROBLEM SET 2

SOLUTIONS 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 information

Supervised Learning (Big Data Analytics)

Supervised 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 information

IP Subnetting: Practical Subnet Design and Address Determination Example

IP 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

About Compound Interest

About Compound Interest About Compound Interest TABLE OF CONTENTS About Compound Interest... 1 What is COMPOUND INTEREST?... 1 Interest... 1 Simple Interest... 1 Compound Interest... 1 Calculations... 3 Calculating How Much to

More information

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. #-approximation algorithm.

! 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 information

Max Flow, Min Cut, and Matchings (Solution)

Max Flow, Min Cut, and Matchings (Solution) Max Flow, Min Cut, and Matchings (Solution) 1. The figure below shows a flow network on which an s-t flow is shown. The capacity of each edge appears as a label next to the edge, and the numbers in boxes

More information

Option Properties. Liuren Wu. Zicklin School of Business, Baruch College. Options Markets. (Hull chapter: 9)

Option Properties. Liuren Wu. Zicklin School of Business, Baruch College. Options Markets. (Hull chapter: 9) Option Properties Liuren Wu Zicklin School of Business, Baruch College Options Markets (Hull chapter: 9) Liuren Wu (Baruch) Option Properties Options Markets 1 / 17 Notation c: European call option price.

More information

Chapter 13: Binary and Mixed-Integer Programming

Chapter 13: Binary and Mixed-Integer Programming Chapter 3: Binary and Mixed-Integer 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 information

24. The Branch and Bound Method

24. 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 NP-complete. Then one can conclude according to the present state of science that no

More information

Chapter 20: Data Analysis

Chapter 20: Data Analysis Chapter 20: Data Analysis Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 20: Data Analysis Decision Support Systems Data Warehousing Data Mining Classification

More information

Broadband Networks. Prof. Dr. Abhay Karandikar. Electrical Engineering Department. Indian Institute of Technology, Bombay. Lecture - 29.

Broadband Networks. Prof. Dr. Abhay Karandikar. Electrical Engineering Department. Indian Institute of Technology, Bombay. Lecture - 29. Broadband Networks Prof. Dr. Abhay Karandikar Electrical Engineering Department Indian Institute of Technology, Bombay Lecture - 29 Voice over IP So, today we will discuss about voice over IP and internet

More information

Dimitris Chatzidimitriou. Corelab NTUA. June 28, 2013

Dimitris 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 information

Finance 197. Simple One-time Interest

Finance 197. Simple One-time Interest Finance 197 Finance We have to work with money every day. While balancing your checkbook or calculating your monthly expenditures on espresso requires only arithmetic, when we start saving, planning for

More information

School Timetabling in Theory and Practice

School Timetabling in Theory and Practice School Timetabling in Theory and Practice Irving van Heuven van Staereling VU University, Amsterdam Faculty of Sciences December 24, 2012 Preface At almost every secondary school and university, some

More information

Activity 1: Using base ten blocks to model operations on decimals

Activity 1: Using base ten blocks to model operations on decimals Rational Numbers 9: Decimal Form of Rational Numbers Objectives To use base ten blocks to model operations on decimal numbers To review the algorithms for addition, subtraction, multiplication and division

More information

Merge Sort. 2004 Goodrich, Tamassia. Merge Sort 1

Merge Sort. 2004 Goodrich, Tamassia. Merge Sort 1 Merge Sort 7 2 9 4 2 4 7 9 7 2 2 7 9 4 4 9 7 7 2 2 9 9 4 4 Merge Sort 1 Divide-and-Conquer Divide-and conquer is a general algorithm design paradigm: Divide: divide the input data S in two disjoint subsets

More information

On the independence number of graphs with maximum degree 3

On the independence number of graphs with maximum degree 3 On the independence number of graphs with maximum degree 3 Iyad A. Kanj Fenghui Zhang Abstract Let G be an undirected graph with maximum degree at most 3 such that G does not contain any of the three graphs

More information

CS 102: SOLUTIONS TO DIVIDE AND CONQUER ALGORITHMS (ASSGN 4)

CS 102: SOLUTIONS TO DIVIDE AND CONQUER ALGORITHMS (ASSGN 4) CS 10: SOLUTIONS TO DIVIDE AND CONQUER ALGORITHMS (ASSGN 4) Problem 1. a. Consider the modified binary search algorithm so that it splits the input not into two sets of almost-equal sizes, but into three

More information

Solving Integer Programming with Branch-and-Bound Technique

Solving Integer Programming with Branch-and-Bound Technique Solving Integer Programming with Branch-and-Bound Technique This is the divide and conquer method. We divide a large problem into a few smaller ones. (This is the branch part.) The conquering part is done

More information

Solutions of Linear Equations in One Variable

Solutions 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 information

2. Filling Data Gaps, Data validation & Descriptive Statistics

2. Filling Data Gaps, Data validation & Descriptive Statistics 2. Filling Data Gaps, Data validation & Descriptive Statistics Dr. Prasad Modak Background Data collected from field may suffer from these problems Data may contain gaps ( = no readings during this period)

More information

The Minimum Consistent Subset Cover Problem and its Applications in Data Mining

The Minimum Consistent Subset Cover Problem and its Applications in Data Mining The Minimum Consistent Subset Cover Problem and its Applications in Data Mining Byron J Gao 1,2, Martin Ester 1, Jin-Yi Cai 2, Oliver Schulte 1, and Hui Xiong 3 1 School of Computing Science, Simon Fraser

More information

Parametric Models Part I: Maximum Likelihood and Bayesian Density Estimation

Parametric Models Part I: Maximum Likelihood and Bayesian Density Estimation Parametric Models Part I: Maximum Likelihood and Bayesian Density Estimation Selim Aksoy Department of Computer Engineering Bilkent University saksoy@cs.bilkent.edu.tr CS 551, Fall 2015 CS 551, Fall 2015

More information

Static Program Transformations for Efficient Software Model Checking

Static Program Transformations for Efficient Software Model Checking Static Program Transformations for Efficient Software Model Checking Shobha Vasudevan Jacob Abraham The University of Texas at Austin Dependable Systems Large and complex systems Software faults are major

More information

1 Lecture: Integration of rational functions by decomposition

1 Lecture: Integration of rational functions by decomposition Lecture: Integration of rational functions by decomposition into partial fractions Recognize and integrate basic rational functions, except when the denominator is a power of an irreducible quadratic.

More information

Chapter 11. 11.1 Load Balancing. Approximation Algorithms. Load Balancing. Load Balancing on 2 Machines. Load Balancing: Greedy Scheduling

Chapter 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 information

Definition 11.1. Given a graph G on n vertices, we define the following quantities:

Definition 11.1. Given a graph G on n vertices, we define the following quantities: Lecture 11 The Lovász ϑ Function 11.1 Perfect graphs We begin with some background on perfect graphs. graphs. First, we define some quantities on Definition 11.1. Given a graph G on n vertices, we define

More information

BENEFIT-COST ANALYSIS Financial and Economic Appraisal using Spreadsheets

BENEFIT-COST ANALYSIS Financial and Economic Appraisal using Spreadsheets BENEFIT-COST ANALYSIS Financial and Economic Appraisal using Spreadsheets Ch. 3: Decision Rules Harry Campbell & Richard Brown School of Economics The University of Queensland Applied Investment Appraisal

More information

Worksheet for Teaching Module Probability (Lesson 1)

Worksheet for Teaching Module Probability (Lesson 1) Worksheet for Teaching Module Probability (Lesson 1) Topic: Basic Concepts and Definitions Equipment needed for each student 1 computer with internet connection Introduction In the regular lectures in

More information

TU e. Advanced Algorithms: experimentation project. The problem: load balancing with bounded look-ahead. Input: integer m 2: number of machines

TU e. Advanced Algorithms: experimentation project. The problem: load balancing with bounded look-ahead. Input: integer m 2: number of machines The problem: load balancing with bounded look-ahead Input: integer m 2: number of machines integer k 0: the look-ahead numbers t 1,..., t n : the job sizes Problem: assign jobs to machines machine to which

More information

Exhibit memory of previously-learned materials by recalling facts, terms, basic concepts, and answers. Key Words

Exhibit memory of previously-learned materials by recalling facts, terms, basic concepts, and answers. Key Words The Six Levels of Questioning Level 1 Knowledge Exhibit memory of previously-learned materials by recalling facts, terms, basic concepts, and answers. who what why when where which omit choose find how

More information

International Journal of Advanced Research in Computer Science and Software Engineering

International 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 information

2) Write in detail the issues in the design of code generator.

2) Write in detail the issues in the design of code generator. COMPUTER SCIENCE AND ENGINEERING VI SEM CSE Principles of Compiler Design Unit-IV Question and answers UNIT IV CODE GENERATION 9 Issues in the design of code generator The target machine Runtime Storage

More information

Chapter 2 Formulas and Decimals

Chapter 2 Formulas and Decimals Chapter Formulas and Decimals Section A Rounding, Comparing, Adding and Subtracting Decimals Look at the following formulas. The first formula (P = A + B + C) is one we use to calculate perimeter of a

More information

THE ENTITY- RELATIONSHIP (ER) MODEL CHAPTER 7 (6/E) CHAPTER 3 (5/E)

THE ENTITY- RELATIONSHIP (ER) MODEL CHAPTER 7 (6/E) CHAPTER 3 (5/E) THE ENTITY- RELATIONSHIP (ER) MODEL CHAPTER 7 (6/E) CHAPTER 3 (5/E) 2 LECTURE OUTLINE Using High-Level, Conceptual Data Models for Database Design Entity-Relationship (ER) model Popular high-level conceptual

More information

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. !-approximation algorithm.

! 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 information

Transaction Analysis SPOTLIGHT. 2 Chapter 40878 Page 53 09/25/07 jhr APPLE COMPUTER, INC.

Transaction Analysis SPOTLIGHT. 2 Chapter 40878 Page 53 09/25/07 jhr APPLE COMPUTER, INC. 2 Chapter 40878 9/25/07 3:18 PM Page 53 2 Transaction Analysis 2 Chapter 40878 Page 53 09/25/07 jhr SPOTLIGHT APPLE COMPUTER, INC. How do you manage your music library? You may use Apple Computer s itunes,

More information