Σ P(i) ( depth T (K i ) + 1),
|
|
- Theresa Wilson
- 6 years ago
- Views:
Transcription
1 EECS 3101 York Uiversity Istructor: Ady Mirzaia DYNAMIC PROGRAMMING: OPIMAL SAIC BINARY SEARCH REES his lecture ote describes a applicatio of the dyamic programmig paradigm o computig the optimal static biary search tree of keys to miimize the expected search time for a give search probability distributio. Suppose we are give acollectio of keys 1 < 2 <... < which are to be stored i a biary search tree. After the tree has bee costructed, oly search operatios will be performed i.e. there will be o isertios or deletios. We are also give aprobability desity fuctio P where P(i) isthe probability of searchig for key i. here are may differet biary search trees where the give keys ca be stored. For a particular tree with these keys, the average umber of comparisos to fid a key, for the give probability desity is Σ P(i) ( depth ( i ) + 1), i=1 where depth ( i )deotes the depth of the ode where i is stored i. he problem we would like to solve is to fid, amog all the possible biary search trees that cotai the keys, oe which miimizes this quatity. Such a tree is called a optimal (static) biary search tree. Note that there may be several optimal biary trees for the give desity fuctio. his is why we speak of a optimal, rather tha the optimum biary search tree. Asimple way to accomplish this is to try out all possible biary trees with odes, computig the average umber of comparisos to fid a key i each tree cosidered, ad selectig a tree with the miimum average. Ufortuately, this simple strategy is ridiculously iefficiet because there are too may trees to try out. I particular, there are ( 2 )/( +1) differet biary trees with odes (if iterested i the derivatio of this formula, see uth, vol. I, pp ). hus, if there are 20 keys, we have to try out 131,282,408,400 differet trees. Computig the average umber of comparisos i each at the rather astoishig speed of 1µsec per tree, will still take 2188 hours or approximately 91 days ad ights of computig to fid a optimal biary search tree (for just 20 keys)! Fortuately, there is a much more efficiet, if less straightforward, way to fid a optimal biary search tree. Let be a biary search tree that cotais i, i+1,..., j for some 1 i j. Weshall see shortly why itisuseful to cosider trees that cotai subsets of successive keys. We defie the cost of as, c( )= Σ j P(l) ( depth ( l ) + 1) Hece, if cotais all keys (i.e. i = 1ad j = ), the cost of is precisely the expected umber of comparisos to fid a key for the give desity fuctio. hus, we ca rephrase our problem as follows: Give adesity fuctio for the keys, fid a miimum cost tree with odes. Before givig the algorithm to fid a optimal biary search tree, we prove two key facts. his is ot so if is missig some of the keys, because i that case the probabilities of the keys that are i do ot sum to 1 that is, P is ot a proper desity fuctio relative to the set of keys ithe tree.
2 -2- Lemma 1: Let be a biary search tree cotaiig keys i, i+1,..., j, L ad R be the left ad right subtrees of respectively. he c( )=c( L ) + c( R ) + Σ j P(l). Proof: his is a easy cosequece of the defiitio of cost of a tree. You should prove it oyour ow. Lemma 2: Let be a biary search tree that has miimum cost amog all trees cotaiig keys i, i+1,..., j ad let m be the key at the root of (so i m j ). he L,the left subtree of, is a biary search tree that has miimum cost amog all trees cotaiig keys i,..., m 1 ;ad R,the right subtree of,isabiary search tree that has miimum cost amog all trees cotaiig keys m+1,..., j. Proof: We prove the cotrapositive. hat is, if either the left or right subtree of fails to satisfy the miimality property asserted i the lemma we show that does ot really have the miimum possible cost amog all trees that cotai i,..., j. Let L ad R be miimum cost biary search trees that cotai i,..., m 1 ad m+1,..., j respectively. hus, c( L ) c( L )ad c( R ) c( R )(*). Further, let be the tree with key m i the root, ad left ad right subtrees L ad R respectively. Evidetly, is a biary search tree that cotais keys i,..., j.if L or R do ot have the miimality property asserted by the lemma, it must be that either c( L )>c( L ), or c( R )>c( R ). his, together with (*) implies that c( L ) + c( R )>c( L ) + c( R ). From this ad Lemma 1 we have, c( )=c( L ) + c( R ) + Σ j P(l) > c( L ) + c( R ) + Σ j P(l) =c( ). hus, c( )>c( ) ad is ot amiimum cost biary search tree amog all trees that cotai keys i,..., j. Computig a Optimal Biary Search ree Lemma 2 is the basis of a efficiet algorithm to fid a optimal biary search tree. Let ij deote a optimal biary search tree cotaiig keys i, i+1,..., j.he 1 is precisely the optimal biary search tree that we wat to costruct. Lemma 2 says that ij must be of the followig form: m i,m-1 m+1,j hat is, its root has key m for some m, i m j, ad its subtrees are i,m 1 ad m+1, j,i.e. miimum cost subtrees cotaiig keys i,..., m 1 ad m+1,..., j respectively. But i,m 1 ad m+1, j are "smaller" trees tha ij. his suggests proceedig iductively, startig with small miimum cost trees (each cotaiig just oe key) ad progressively buildig larger ad larger
3 -3- miimum cost trees, util we have a miimum cost tree with odes which is what we are lookig for. More specifically, we start the iductio with miimum cost trees each of which cotais exactly oe key, ad proceed by costructig miimum cost trees with 2, 3,..., successive keys. Note that there are exactly d +1 groups of d successive keys for each d = 1,...,. hus, istead of cosiderig all possible trees with odes we cosider oly (miimum cost) trees with 1 ode each, 1 (miimum cost) trees with 2 odes each,...,1miimum cost tree with odes, i.e. a total of ( +1) /2 trees much fewer tha ( 2 )/( +1). So ow the questio is how tocompute these trees ij iductively. he basis of the iductio, i.e. whe j i = 0istrivial. I this case we have j = i ad the miimum cost biary search tree that stores i (i fact the oly such tree!) is a sigle ode cotaiig i ;its cost is c( ii )=P(i). For the iductive step, take j i >0 ad assume that we have already computed all the uv s ad their costs, for v u < j i. Let imj be the tree with m i the root, ad left ad right subtrees i,m 1 ad m+1, j respectively. Aswesaw before, Lemma 2 implies that ij is the miimum cost tree amog the imj s. hus we ca fid ij simply by tryig out all the imj s for m = i, i +1,..., j. Ifact Lemma 1 tells us how tocompute c( imj )efficietly, sothat "tryig out" each possible m will ot take too log: Sice (m 1) i ad j (m +1) are both < j i, wehave already (iductively) computed i,m 1 ad m+1, j as well as their costs, c( i,m 1 )ad c( m+1, j ). Lemma 1 the tells us how toget c( imj )iterms of these. Note that whe m = i the left subtree of imj is i,i 1 ad whe m = j the right subtree of imj is j+1, j. Wedefie ij to be empty if i > j, ad the cost of a empty tree to be 0. Figure 1 shows this algorithm i pseudo-code. he algorithm takes as iput a array Prob[1.. ], which specifies the probability desity (i.e. Prob[i] = P(i)). It computes two twodimesioal arrays, Root ad Cost, where Root[i, j] isthe root of ij,ad Cost[i, j] = c( ij ), for 1 i j. o help compute Root ad Cost the algorithm maitais a third array, SumOf- Prob, where SumOfProb[i] = Σ i P(l) for 1 i, ad SumOfProb[0] = 0. Note that j Σ P(l) =SumOfProb[j] SumOfProb[i 1]. l=1 he algorithm of Figure 1 does ot explicitly costruct a optimal biary search tree but such a tree is implicit i the iformatio i array Root. Asaexercise you should write a algorithm which, give Root ad a array ey[1.. ], where ey[i] = i,costructs a optimal biary search tree. It is ot hard to show that this algorithm has worst case time complexity Θ( 3 ). A slight modificatio of this algorithm leads to a Θ( 2 )complexity (if iterested, see D.E. uth, "Optimum biary search trees," Acta Iformatica, vol. 1 (1971), pp ) Usuccessful Searches I this discussio we have oly cosidered successful searches. However, if we take ito accout usuccessful searches, maybe the costructed tree is o loger optimal. Fortuately, this For techical reasos that will become apparet whe you look at the algorithm carefully we eed to set Cost[i, i 1] = 0 for1 i +1. Recall that i,i 1 is empty ad thus has cost 0.
4 -4- algorithm OptimalBS ( Prob[1.. ] ); begi (* iitializatio *) for i 1 to +1 do Cost[i, i 1] 0; SumOfProb[0] 0; for i 1 to do begi SumOfProb[i] Prob[i] + SumOfProb[i 1]; Root[i, i] i; Cost[i, i] Prob[i] ed; for d 1 to 1 do (* compute ifo about trees with d + 1 cosecutive keys *) for i 1 to d do begi (* compute Root[i, j] ad Cost[i, j] *) j i + d; MiCost + ; for m i to j do begi (* fid m betwee i ad j so that c( imj )ismiimum *) c Cost[i, m 1] + Cost[m +1, j] + SumOfProb[ j] SumOfProb[i 1]; if c < MiCost the begi MiCost c; r m ed ed; Root[i, j] r; Cost[i, j] MiCost ed ed Figure 1: Algorithm for optimal biary search tree. problem ca be take care of i a straightforward maer. o fid a optimal biary search tree i the case where both successful ad usuccessful searches are take ito accout, we must kow the probability desity for both successful ad usuccessful searches. So, i additio to P(i) weare also give Q(i) for 0 i, where Q(0) =prob. ofsearchig for keys < 1 ; Q(i) =prob. ofsearchig for keys x, i < x < i+1,for 1 i < ; Q() =prob. ofsearchig for keys >. I each biary search tree cotaiig keys 1, 2,..., we add +1 exteral odes,,..., E.his is illustrated below; the exteral odes are draw i boxes, as usual.
5 E 4 E2 he average umber of comparisos for a successful or usuccessful search i such a tree is Σ P(i) ( depth ( i ) + 1)+ Σ Q(i) depth (E i ). i=1 he left term is the cotributio to the average umber of comparisos by the successful searches ad the right term is the cotributio to the average umber of comparisos by the usuccessful searches. Now wewat to fid a tree that miimizes this quatity. We ca proceed exactly as before, except that the defiitio of the cost of a tree with cosecutive keys i, i+1,..., j is slightly modified to accout for the usuccessful searches. Namely, itbecomes, i=0 c ( )= Σ j P(l) ( depth ( l ) + 1)+ With this cost fuctio Lemma 1 is slightly differet: j Σ Q(l) depth (E l ). Lemma 1 : Let be a biary search tree cotaiig keys i, i+1,..., j, L ad R be the left ad right subtrees of respectively. he 1 c ( )=c ( L ) + c ( R ) + Q(i 1) + Σ j (P(l) + Q(l)). Everythig else works out exactly as before. I particular, Lemma 2 is still valid (check this!). As a exercise show how to modify the algorithm i Figure 1 to accout for these chages. Example: Suppose we wat to fid a optimal biary search tree for the dictioary {begi, ed, goto, repeat, util} for the followig probabilities of searchig for these keys (P(i) s) ad keys alphabetically i betwee (the Q(i) s): 1 =begi 2 =ed 3 =goto =repeat 5 =util P(1 ) =.1 P(2 ) =.1 P(3 ) =. 05 P(4)=.05 P(5 ) =. 05 Q(0)=.05 Q(1 ) =. 05 Q(2 ) =. 2 Q(3 ) =. 2 Q(4)=.1 Q(5 ) =. 05 he trees ij as computed by the algorithm o this example are show i the table below with their costs. he computatio proceeds row by row (i.e. to compute the trees ad costs i row d, all the trees up to row d 1 must have bee previously computed). he optimal biary search tree 1,5 is show o the last row. You are strogly ecouraged to trace this example carefully. Eve if you thik you uderstad the algorithm from the previous abstract discussio, you may be surprised at how much better you ll uderstad it after workig out a example.
6 -6- d = -1 : E c( )=0 10 c( )=0 21 c( )=0 32 c( 43)=0 c( )=0 54 c( 65)=0 d = 0 : E 4 c( )=.2 11 c( )= c( )= c( )= c( )=.2 55 d = 1 : E E 4 c( 12) =.7 c( ) =.95 c( ) =.95 c( ) =.65 45
7 -7- d = 2 : E E1 E2 E E 4 E 5 c( ) = 1.4 c( ) = 1.45 c( ) = d = 3 : E E E 4 5 c( ) = 1.95 c( 14 25) = 1.85 d = 4 : c( 15) = 2.35
Examples and Applications of Binary Search
Toy Gog ITEE Uiersity of Queeslad I the secod lecture last week we studied the biary search algorithm that soles the problem of determiig if a particular alue appears i a sorted list of iteger or ot. We
More information5.3 Recursive definitions and structural induction
/8/05 5.3 Recursive defiitios ad structural iductio CSE03 Discrete Computatioal Structures Lecture 6 A recursively defied picture Recursive defiitios e sequece of powers of is give by a = for =0,,, Ca
More informationLecture 1: Introduction and Strassen s Algorithm
5-750: Graduate Algorithms Jauary 7, 08 Lecture : Itroductio ad Strasse s Algorithm Lecturer: Gary Miller Scribe: Robert Parker Itroductio Machie models I this class, we will primarily use the Radom Access
More informationCIS 121 Data Structures and Algorithms with Java Spring Stacks, Queues, and Heaps Monday, February 18 / Tuesday, February 19
CIS Data Structures ad Algorithms with Java Sprig 09 Stacks, Queues, ad Heaps Moday, February 8 / Tuesday, February 9 Stacks ad Queues Recall the stack ad queue ADTs (abstract data types from lecture.
More informationThe Adjacency Matrix and The nth Eigenvalue
Spectral Graph Theory Lecture 3 The Adjacecy Matrix ad The th Eigevalue Daiel A. Spielma September 5, 2012 3.1 About these otes These otes are ot ecessarily a accurate represetatio of what happeed i class.
More information6.854J / J Advanced Algorithms Fall 2008
MIT OpeCourseWare http://ocw.mit.edu 6.854J / 18.415J Advaced Algorithms Fall 2008 For iformatio about citig these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. 18.415/6.854 Advaced Algorithms
More informationCSC165H1 Worksheet: Tutorial 8 Algorithm analysis (SOLUTIONS)
CSC165H1, Witer 018 Learig Objectives By the ed of this worksheet, you will: Aalyse the ruig time of fuctios cotaiig ested loops. 1. Nested loop variatios. Each of the followig fuctios takes as iput a
More informationModule 8-7: Pascal s Triangle and the Binomial Theorem
Module 8-7: Pascal s Triagle ad the Biomial Theorem Gregory V. Bard April 5, 017 A Note about Notatio Just to recall, all of the followig mea the same thig: ( 7 7C 4 C4 7 7C4 5 4 ad they are (all proouced
More informationCSE 417: Algorithms and Computational Complexity
Time CSE 47: Algorithms ad Computatioal Readig assigmet Read Chapter of The ALGORITHM Desig Maual Aalysis & Sortig Autum 00 Paul Beame aalysis Problem size Worst-case complexity: max # steps algorithm
More informationHomework 1 Solutions MA 522 Fall 2017
Homework 1 Solutios MA 5 Fall 017 1. Cosider the searchig problem: Iput A sequece of umbers A = [a 1,..., a ] ad a value v. Output A idex i such that v = A[i] or the special value NIL if v does ot appear
More informationThe isoperimetric problem on the hypercube
The isoperimetric problem o the hypercube Prepared by: Steve Butler November 2, 2005 1 The isoperimetric problem We will cosider the -dimesioal hypercube Q Recall that the hypercube Q is a graph whose
More informationOn (K t e)-saturated Graphs
Noame mauscript No. (will be iserted by the editor O (K t e-saturated Graphs Jessica Fuller Roald J. Gould the date of receipt ad acceptace should be iserted later Abstract Give a graph H, we say a graph
More information1 Graph Sparsfication
CME 305: Discrete Mathematics ad Algorithms 1 Graph Sparsficatio I this sectio we discuss the approximatio of a graph G(V, E) by a sparse graph H(V, F ) o the same vertex set. I particular, we cosider
More informationSorting in Linear Time. Data Structures and Algorithms Andrei Bulatov
Sortig i Liear Time Data Structures ad Algorithms Adrei Bulatov Algorithms Sortig i Liear Time 7-2 Compariso Sorts The oly test that all the algorithms we have cosidered so far is compariso The oly iformatio
More informationProtected points in ordered trees
Applied Mathematics Letters 008 56 50 www.elsevier.com/locate/aml Protected poits i ordered trees Gi-Sag Cheo a, Louis W. Shapiro b, a Departmet of Mathematics, Sugkyukwa Uiversity, Suwo 440-746, Republic
More informationOnes Assignment Method for Solving Traveling Salesman Problem
Joural of mathematics ad computer sciece 0 (0), 58-65 Oes Assigmet Method for Solvig Travelig Salesma Problem Hadi Basirzadeh Departmet of Mathematics, Shahid Chamra Uiversity, Ahvaz, Ira Article history:
More informationCHAPTER IV: GRAPH THEORY. Section 1: Introduction to Graphs
CHAPTER IV: GRAPH THEORY Sectio : Itroductio to Graphs Sice this class is called Number-Theoretic ad Discrete Structures, it would be a crime to oly focus o umber theory regardless how woderful those topics
More informationCIS 121 Data Structures and Algorithms with Java Spring Stacks and Queues Monday, February 12 / Tuesday, February 13
CIS Data Structures ad Algorithms with Java Sprig 08 Stacks ad Queues Moday, February / Tuesday, February Learig Goals Durig this lab, you will: Review stacks ad queues. Lear amortized ruig time aalysis
More informationCIS 121. Introduction to Trees
CIS 121 Itroductio to Trees 1 Tree ADT Tree defiitio q A tree is a set of odes which may be empty q If ot empty, the there is a distiguished ode r, called root ad zero or more o-empty subtrees T 1, T 2,
More informationcondition w i B i S maximum u i
ecture 10 Dyamic Programmig 10.1 Kapsack Problem November 1, 2004 ecturer: Kamal Jai Notes: Tobias Holgers We are give a set of items U = {a 1, a 2,..., a }. Each item has a weight w i Z + ad a utility
More information15-859E: Advanced Algorithms CMU, Spring 2015 Lecture #2: Randomized MST and MST Verification January 14, 2015
15-859E: Advaced Algorithms CMU, Sprig 2015 Lecture #2: Radomized MST ad MST Verificatio Jauary 14, 2015 Lecturer: Aupam Gupta Scribe: Yu Zhao 1 Prelimiaries I this lecture we are talkig about two cotets:
More informationMajor CSL Write your name and entry no on every sheet of the answer script. Time 2 Hrs Max Marks 70
NOTE:. Attempt all seve questios. Major CSL 02 2. Write your ame ad etry o o every sheet of the aswer script. Time 2 Hrs Max Marks 70 Q No Q Q 2 Q 3 Q 4 Q 5 Q 6 Q 7 Total MM 6 2 4 0 8 4 6 70 Q. Write a
More informationCIS 121 Data Structures and Algorithms with Java Fall Big-Oh Notation Tuesday, September 5 (Make-up Friday, September 8)
CIS 11 Data Structures ad Algorithms with Java Fall 017 Big-Oh Notatio Tuesday, September 5 (Make-up Friday, September 8) Learig Goals Review Big-Oh ad lear big/small omega/theta otatios Practice solvig
More informationExact Minimum Lower Bound Algorithm for Traveling Salesman Problem
Exact Miimum Lower Boud Algorithm for Travelig Salesma Problem Mohamed Eleiche GeoTiba Systems mohamed.eleiche@gmail.com Abstract The miimum-travel-cost algorithm is a dyamic programmig algorithm to compute
More information1.2 Binomial Coefficients and Subsets
1.2. BINOMIAL COEFFICIENTS AND SUBSETS 13 1.2 Biomial Coefficiets ad Subsets 1.2-1 The loop below is part of a program to determie the umber of triagles formed by poits i the plae. for i =1 to for j =
More informationBig-O Analysis. Asymptotics
Big-O Aalysis 1 Defiitio: Suppose that f() ad g() are oegative fuctios of. The we say that f() is O(g()) provided that there are costats C > 0 ad N > 0 such that for all > N, f() Cg(). Big-O expresses
More informationLecture 5. Counting Sort / Radix Sort
Lecture 5. Coutig Sort / Radix Sort T. H. Corme, C. E. Leiserso ad R. L. Rivest Itroductio to Algorithms, 3rd Editio, MIT Press, 2009 Sugkyukwa Uiversity Hyuseug Choo choo@skku.edu Copyright 2000-2018
More informationLecture Notes 6 Introduction to algorithm analysis CSS 501 Data Structures and Object-Oriented Programming
Lecture Notes 6 Itroductio to algorithm aalysis CSS 501 Data Structures ad Object-Orieted Programmig Readig for this lecture: Carrao, Chapter 10 To be covered i this lecture: Itroductio to algorithm aalysis
More informationWhat are we going to learn? CSC Data Structures Analysis of Algorithms. Overview. Algorithm, and Inputs
What are we goig to lear? CSC316-003 Data Structures Aalysis of Algorithms Computer Sciece North Carolia State Uiversity Need to say that some algorithms are better tha others Criteria for evaluatio Structure
More informationPriority Queues. Binary Heaps
Priority Queues Biary Heaps Priority Queues Priority: some property of a object that allows it to be prioritized with respect to other objects of the same type Mi Priority Queue: homogeeous collectio of
More informationMinimum Spanning Trees
Miimum Spaig Trees Miimum Spaig Trees Spaig subgraph Subgraph of a graph G cotaiig all the vertices of G Spaig tree Spaig subgraph that is itself a (free) tree Miimum spaig tree (MST) Spaig tree of a weighted
More information6.851: Advanced Data Structures Spring Lecture 17 April 24
6.851: Advaced Data Structures Sprig 2012 Prof. Erik Demaie Lecture 17 April 24 Scribes: David Bejami(2012), Li Fei(2012), Yuzhi Zheg(2012),Morteza Zadimoghaddam(2010), Aaro Berstei(2007) 1 Overview Up
More informationPseudocode ( 1.1) Analysis of Algorithms. Primitive Operations. Pseudocode Details. Running Time ( 1.1) Estimating performance
Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Pseudocode ( 1.1) High-level descriptio of a algorithm More structured
More information9.1. Sequences and Series. Sequences. What you should learn. Why you should learn it. Definition of Sequence
_9.qxd // : AM Page Chapter 9 Sequeces, Series, ad Probability 9. Sequeces ad Series What you should lear Use sequece otatio to write the terms of sequeces. Use factorial otatio. Use summatio otatio to
More informationPython Programming: An Introduction to Computer Science
Pytho Programmig: A Itroductio to Computer Sciece Chapter 6 Defiig Fuctios Pytho Programmig, 2/e 1 Objectives To uderstad why programmers divide programs up ito sets of cooperatig fuctios. To be able to
More informationData Structures Week #5. Trees (Ağaçlar)
Data Structures Week #5 Trees Ağaçlar) Trees Ağaçlar) Toros Gökarı Avrupa Gökarı October 28, 2014 Boraha Tümer, Ph.D. 2 Trees Ağaçlar) October 28, 2014 Boraha Tümer, Ph.D. 3 Outlie Trees Deiitios Implemetatio
More informationOn Infinite Groups that are Isomorphic to its Proper Infinite Subgroup. Jaymar Talledo Balihon. Abstract
O Ifiite Groups that are Isomorphic to its Proper Ifiite Subgroup Jaymar Talledo Baliho Abstract Two groups are isomorphic if there exists a isomorphism betwee them Lagrage Theorem states that the order
More informationECE4050 Data Structures and Algorithms. Lecture 6: Searching
ECE4050 Data Structures ad Algorithms Lecture 6: Searchig 1 Search Give: Distict keys k 1, k 2,, k ad collectio L of records of the form (k 1, I 1 ), (k 2, I 2 ),, (k, I ) where I j is the iformatio associated
More informationMathematical Stat I: solutions of homework 1
Mathematical Stat I: solutios of homework Name: Studet Id N:. Suppose we tur over cards simultaeously from two well shuffled decks of ordiary playig cards. We say we obtai a exact match o a particular
More informationarxiv: v2 [cs.ds] 24 Mar 2018
Similar Elemets ad Metric Labelig o Complete Graphs arxiv:1803.08037v [cs.ds] 4 Mar 018 Pedro F. Felzeszwalb Brow Uiversity Providece, RI, USA pff@brow.edu March 8, 018 We cosider a problem that ivolves
More informationMAXIMUM MATCHINGS IN COMPLETE MULTIPARTITE GRAPHS
Fura Uiversity Electroic Joural of Udergraduate Matheatics Volue 00, 1996 6-16 MAXIMUM MATCHINGS IN COMPLETE MULTIPARTITE GRAPHS DAVID SITTON Abstract. How ay edges ca there be i a axiu atchig i a coplete
More informationLecture 9: Exam I Review
CS 111 (Law): Program Desig I Lecture 9: Exam I Review Robert H. Sloa & Richard Warer Uiversity of Illiois, Chicago September 22, 2016 This Class Discuss midterm topics Go over practice examples Aswer
More informationComputational Geometry
Computatioal Geometry Chapter 4 Liear programmig Duality Smallest eclosig disk O the Ageda Liear Programmig Slides courtesy of Craig Gotsma 4. 4. Liear Programmig - Example Defie: (amout amout cosumed
More informationComputers and Scientific Thinking
Computers ad Scietific Thikig David Reed, Creighto Uiversity Chapter 15 JavaScript Strigs 1 Strigs as Objects so far, your iteractive Web pages have maipulated strigs i simple ways use text box to iput
More informationRandom Graphs and Complex Networks T
Radom Graphs ad Complex Networks T-79.7003 Charalampos E. Tsourakakis Aalto Uiversity Lecture 3 7 September 013 Aoucemet Homework 1 is out, due i two weeks from ow. Exercises: Probabilistic iequalities
More informationAnalysis Metrics. Intro to Algorithm Analysis. Slides. 12. Alg Analysis. 12. Alg Analysis
Itro to Algorithm Aalysis Aalysis Metrics Slides. Table of Cotets. Aalysis Metrics 3. Exact Aalysis Rules 4. Simple Summatio 5. Summatio Formulas 6. Order of Magitude 7. Big-O otatio 8. Big-O Theorems
More informationCounting the Number of Minimum Roman Dominating Functions of a Graph
Coutig the Number of Miimum Roma Domiatig Fuctios of a Graph SHI ZHENG ad KOH KHEE MENG, Natioal Uiversity of Sigapore We provide two algorithms coutig the umber of miimum Roma domiatig fuctios of a graph
More information. Written in factored form it is easy to see that the roots are 2, 2, i,
CMPS A Itroductio to Programmig Programmig Assigmet 4 I this assigmet you will write a java program that determies the real roots of a polyomial that lie withi a specified rage. Recall that the roots (or
More informationUniversity of Waterloo Department of Electrical and Computer Engineering ECE 250 Algorithms and Data Structures
Uiversity of Waterloo Departmet of Electrical ad Computer Egieerig ECE 250 Algorithms ad Data Structures Midterm Examiatio ( pages) Istructor: Douglas Harder February 7, 2004 7:30-9:00 Name (last, first)
More informationPlanar graphs. Definition. A graph is planar if it can be drawn on the plane in such a way that no two edges cross each other.
Plaar graphs Defiitio. A graph is plaar if it ca be draw o the plae i such a way that o two edges cross each other. Example: Face 1 Face 2 Exercise: Which of the followig graphs are plaar? K, P, C, K,m,
More informationCh 9.3 Geometric Sequences and Series Lessons
Ch 9.3 Geometric Sequeces ad Series Lessos SKILLS OBJECTIVES Recogize a geometric sequece. Fid the geeral, th term of a geometric sequece. Evaluate a fiite geometric series. Evaluate a ifiite geometric
More informationGraphs. Minimum Spanning Trees. Slides by Rose Hoberman (CMU)
Graphs Miimum Spaig Trees Slides by Rose Hoberma (CMU) Problem: Layig Telephoe Wire Cetral office 2 Wirig: Naïve Approach Cetral office Expesive! 3 Wirig: Better Approach Cetral office Miimize the total
More informationCounting Regions in the Plane and More 1
Coutig Regios i the Plae ad More 1 by Zvezdelia Stakova Berkeley Math Circle Itermediate I Group September 016 1. Overarchig Problem Problem 1 Regios i a Circle. The vertices of a polygos are arraged o
More informationCS200: Hash Tables. Prichard Ch CS200 - Hash Tables 1
CS200: Hash Tables Prichard Ch. 13.2 CS200 - Hash Tables 1 Table Implemetatios: average cases Search Add Remove Sorted array-based Usorted array-based Balaced Search Trees O(log ) O() O() O() O(1) O()
More informationRecursion. Recursion. Mathematical induction: example. Recursion. The sum of the first n odd numbers is n 2 : Informal proof: Principle:
Recursio Recursio Jordi Cortadella Departmet of Computer Sciece Priciple: Reduce a complex problem ito a simpler istace of the same problem Recursio Itroductio to Programmig Dept. CS, UPC 2 Mathematical
More informationCSC 220: Computer Organization Unit 11 Basic Computer Organization and Design
College of Computer ad Iformatio Scieces Departmet of Computer Sciece CSC 220: Computer Orgaizatio Uit 11 Basic Computer Orgaizatio ad Desig 1 For the rest of the semester, we ll focus o computer architecture:
More informationof types having a total order and a predecessor and a successor function. In the
J. Fuctioal Programmig 1 (1): 1{000, Jauary 1993 c 1993 Cambridge Uiversity Press 1 F U N C T I O N A L P E A R L S Diets for Fat Sets Marti Erwig FerUiversitat Hage, Praktische Iformatik IV 58084 Hage,
More informationCombination Labelings Of Graphs
Applied Mathematics E-Notes, (0), - c ISSN 0-0 Available free at mirror sites of http://wwwmaththuedutw/ame/ Combiatio Labeligs Of Graphs Pak Chig Li y Received February 0 Abstract Suppose G = (V; E) is
More informationWhich movie we can suggest to Anne?
ECOLE CENTRALE SUPELEC MASTER DSBI DECISION MODELING TUTORIAL COLLABORATIVE FILTERING AS A MODEL OF GROUP DECISION-MAKING You kow that the low-tech way to get recommedatios for products, movies, or etertaiig
More informationProject 2.5 Improved Euler Implementation
Project 2.5 Improved Euler Implemetatio Figure 2.5.10 i the text lists TI-85 ad BASIC programs implemetig the improved Euler method to approximate the solutio of the iitial value problem dy dx = x+ y,
More informationAlgorithm. Counting Sort Analysis of Algorithms
Algorithm Coutig Sort Aalysis of Algorithms Assumptios: records Coutig sort Each record cotais keys ad data All keys are i the rage of 1 to k Space The usorted list is stored i A, the sorted list will
More informationAlgorithms for Disk Covering Problems with the Most Points
Algorithms for Disk Coverig Problems with the Most Poits Bi Xiao Departmet of Computig Hog Kog Polytechic Uiversity Hug Hom, Kowloo, Hog Kog csbxiao@comp.polyu.edu.hk Qigfeg Zhuge, Yi He, Zili Shao, Edwi
More informationc-dominating Sets for Families of Graphs
c-domiatig Sets for Families of Graphs Kelsie Syder Mathematics Uiversity of Mary Washigto April 6, 011 1 Abstract The topic of domiatio i graphs has a rich history, begiig with chess ethusiasts i the
More informationAn Efficient Algorithm for Graph Bisection of Triangularizations
A Efficiet Algorithm for Graph Bisectio of Triagularizatios Gerold Jäger Departmet of Computer Sciece Washigto Uiversity Campus Box 1045 Oe Brookigs Drive St. Louis, Missouri 63130-4899, USA jaegerg@cse.wustl.edu
More informationAppendix D. Controller Implementation
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Iterface 5 th Editio Appedix D Cotroller Implemetatio Cotroller Implemetatios Combiatioal logic (sigle-cycle); Fiite state machie (multi-cycle, pipelied);
More informationEE123 Digital Signal Processing
Last Time EE Digital Sigal Processig Lecture 7 Block Covolutio, Overlap ad Add, FFT Discrete Fourier Trasform Properties of the Liear covolutio through circular Today Liear covolutio with Overlap ad add
More informationCOMP 558 lecture 6 Sept. 27, 2010
Radiometry We have discussed how light travels i straight lies through space. We would like to be able to talk about how bright differet light rays are. Imagie a thi cylidrical tube ad cosider the amout
More informationHeaps. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015
Presetatio for use with the textbook Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 201 Heaps 201 Goodrich ad Tamassia xkcd. http://xkcd.com/83/. Tree. Used with permissio uder
More informationDATA STRUCTURES. amortized analysis binomial heaps Fibonacci heaps union-find. Data structures. Appetizer. Appetizer
Data structures DATA STRUCTURES Static problems. Give a iput, produce a output. Ex. Sortig, FFT, edit distace, shortest paths, MST, max-flow,... amortized aalysis biomial heaps Fiboacci heaps uio-fid Dyamic
More informationLecturers: Sanjam Garg and Prasad Raghavendra Feb 21, Midterm 1 Solutions
U.C. Berkeley CS170 : Algorithms Midterm 1 Solutios Lecturers: Sajam Garg ad Prasad Raghavedra Feb 1, 017 Midterm 1 Solutios 1. (4 poits) For the directed graph below, fid all the strogly coected compoets
More informationINTERSECTION CORDIAL LABELING OF GRAPHS
INTERSECTION CORDIAL LABELING OF GRAPHS G Meea, K Nagaraja Departmet of Mathematics, PSR Egieerig College, Sivakasi- 66 4, Virudhuagar(Dist) Tamil Nadu, INDIA meeag9@yahoocoi Departmet of Mathematics,
More informationSorting 9/15/2009. Sorting Problem. Insertion Sort: Soundness. Insertion Sort. Insertion Sort: Running Time. Insertion Sort: Soundness
9/5/009 Algorithms Sortig 3- Sortig Sortig Problem The Sortig Problem Istace: A sequece of umbers Objective: A permutatio (reorderig) such that a ' K a' a, K,a a ', K, a' of the iput sequece The umbers
More informationBig-O Analysis. Asymptotics
Big-O Aalysis 1 Defiitio: Suppose that f() ad g() are oegative fuctios of. The we say that f() is O(g()) provided that there are costats C > 0 ad N > 0 such that for all > N, f() Cg(). Big-O expresses
More informationIntroduction to Sigma Notation
Itroductio to Siga Notatio Steph de Silva //207 What is siga otatio? is the capital Greek letter for the soud s I this case, it s just shorthad for su Siga otatio is what we use whe we have a series of
More informationGreedy Algorithms. Interval Scheduling. Greedy Algorithms. Interval scheduling. Greedy Algorithms. Interval Scheduling
Greedy Algorithms Greedy Algorithms Witer Paul Beame Hard to defie exactly but ca give geeral properties Solutio is built i small steps Decisios o how to build the solutio are made to maximize some criterio
More informationPattern Recognition Systems Lab 1 Least Mean Squares
Patter Recogitio Systems Lab 1 Least Mea Squares 1. Objectives This laboratory work itroduces the OpeCV-based framework used throughout the course. I this assigmet a lie is fitted to a set of poits usig
More informationInvestigation Monitoring Inventory
Ivestigatio Moitorig Ivetory Name Period Date Art Smith has bee providig the prits of a egravig to FieArt Gallery. He plas to make just 2000 more prits. FieArt has already received 70 of Art s prits. The
More informationMinimum Spanning Trees
Presetatio for use with the textbook, lgorithm esig ad pplicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 0 Miimum Spaig Trees 0 Goodrich ad Tamassia Miimum Spaig Trees pplicatio: oectig a Network Suppose
More informationLU Decomposition Method
SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS LU Decompositio Method Jamie Traha, Autar Kaw, Kevi Marti Uiversity of South Florida Uited States of America kaw@eg.usf.edu http://umericalmethods.eg.usf.edu Itroductio
More informationMinimum Spanning Trees. Application: Connecting a Network
Miimum Spaig Tree // : Presetatio for use with the textbook, lgorithm esig ad pplicatios, by M. T. oodrich ad R. Tamassia, Wiley, Miimum Spaig Trees oodrich ad Tamassia Miimum Spaig Trees pplicatio: oectig
More informationHash Tables. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015.
Presetatio for use with the textbook Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 2015 Hash Tables xkcd. http://xkcd.com/221/. Radom Number. Used with permissio uder Creative
More informationHow do we evaluate algorithms?
F2 Readig referece: chapter 2 + slides Algorithm complexity Big O ad big Ω To calculate ruig time Aalysis of recursive Algorithms Next time: Litterature: slides mostly The first Algorithm desig methods:
More informationChapter 10. Defining Classes. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 10 Defiig Classes Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 10.1 Structures 10.2 Classes 10.3 Abstract Data Types 10.4 Itroductio to Iheritace Copyright 2015 Pearso Educatio,
More informationCS473-Algorithms I. Lecture 2. Asymptotic Notation. CS 473 Lecture 2 1
CS473-Algorithms I Lecture Asymptotic Notatio CS 473 Lecture 1 O-otatio (upper bouds) f() = O(g()) if positive costats c, 0 such that e.g., = O( 3 ) 0 f() cg(), 0 c 3 c c = 1 & 0 = or c = & 0 = 1 Asymptotic
More informationSolution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Spring, Instructions:
CS 604 Data Structures Midterm Sprig, 00 VIRG INIA POLYTECHNIC INSTITUTE AND STATE U T PROSI M UNI VERSI TY Istructios: Prit your ame i the space provided below. This examiatio is closed book ad closed
More informationThe Closest Line to a Data Set in the Plane. David Gurney Southeastern Louisiana University Hammond, Louisiana
The Closest Lie to a Data Set i the Plae David Gurey Southeaster Louisiaa Uiversity Hammod, Louisiaa ABSTRACT This paper looks at three differet measures of distace betwee a lie ad a data set i the plae:
More informationLecture 2: Spectra of Graphs
Spectral Graph Theory ad Applicatios WS 20/202 Lecture 2: Spectra of Graphs Lecturer: Thomas Sauerwald & He Su Our goal is to use the properties of the adjacecy/laplacia matrix of graphs to first uderstad
More informationOctahedral Graph Scaling
Octahedral Graph Scalig Peter Russell Jauary 1, 2015 Abstract There is presetly o strog iterpretatio for the otio of -vertex graph scalig. This paper presets a ew defiitio for the term i the cotext of
More informationCSE 2320 Notes 8: Sorting. (Last updated 10/3/18 7:16 PM) Idea: Take an unsorted (sub)array and partition into two subarrays such that.
CSE Notes 8: Sortig (Last updated //8 7:6 PM) CLRS 7.-7., 9., 8.-8. 8.A. QUICKSORT Cocepts Idea: Take a usorted (sub)array ad partitio ito two subarrays such that p q r x y z x y y z Pivot Customarily,
More informationThe number n of subintervals times the length h of subintervals gives length of interval (b-a).
Simulator with MadMath Kit: Riema Sums (Teacher s pages) I your kit: 1. GeoGebra file: Ready-to-use projector sized simulator: RiemaSumMM.ggb 2. RiemaSumMM.pdf (this file) ad RiemaSumMMEd.pdf (educator's
More informationAdministrative UNSUPERVISED LEARNING. Unsupervised learning. Supervised learning 11/25/13. Final project. No office hours today
Admiistrative Fial project No office hours today UNSUPERVISED LEARNING David Kauchak CS 451 Fall 2013 Supervised learig Usupervised learig label label 1 label 3 model/ predictor label 4 label 5 Supervised
More informationLower Bounds for Sorting
Liear Sortig Topics Covered: Lower Bouds for Sortig Coutig Sort Radix Sort Bucket Sort Lower Bouds for Sortig Compariso vs. o-compariso sortig Decisio tree model Worst case lower boud Compariso Sortig
More informationStrong Complementary Acyclic Domination of a Graph
Aals of Pure ad Applied Mathematics Vol 8, No, 04, 83-89 ISSN: 79-087X (P), 79-0888(olie) Published o 7 December 04 wwwresearchmathsciorg Aals of Strog Complemetary Acyclic Domiatio of a Graph NSaradha
More informationLecture Notes on Integer Linear Programming
Lecture Notes o Iteger Liear Programmig Roel va de Broek October 15, 2018 These otes supplemet the material o (iteger) liear programmig covered by the lectures i the course Algorithms for Decisio Support.
More informationPolynomial Functions and Models. Learning Objectives. Polynomials. P (x) = a n x n + a n 1 x n a 1 x + a 0, a n 0
Polyomial Fuctios ad Models 1 Learig Objectives 1. Idetify polyomial fuctios ad their degree 2. Graph polyomial fuctios usig trasformatios 3. Idetify the real zeros of a polyomial fuctio ad their multiplicity
More informationPerformance Plus Software Parameter Definitions
Performace Plus+ Software Parameter Defiitios/ Performace Plus Software Parameter Defiitios Chapma Techical Note-TG-5 paramete.doc ev-0-03 Performace Plus+ Software Parameter Defiitios/2 Backgroud ad Defiitios
More informationOur Learning Problem, Again
Noparametric Desity Estimatio Matthew Stoe CS 520, Sprig 2000 Lecture 6 Our Learig Problem, Agai Use traiig data to estimate ukow probabilities ad probability desity fuctios So far, we have depeded o describig
More informationWeston Anniversary Fund
Westo Olie Applicatio Guide 2018 1 This guide is desiged to help charities applyig to the Westo to use our olie applicatio form. The Westo is ope to applicatios from 5th Jauary 2018 ad closes o 30th Jue
More informationOur second algorithm. Comp 135 Machine Learning Computer Science Tufts University. Decision Trees. Decision Trees. Decision Trees.
Comp 135 Machie Learig Computer Sciece Tufts Uiversity Fall 2017 Roi Khardo Some of these slides were adapted from previous slides by Carla Brodley Our secod algorithm Let s look at a simple dataset for
More informationBASED ON ITERATIVE ERROR-CORRECTION
A COHPARISO OF CRYPTAALYTIC PRICIPLES BASED O ITERATIVE ERROR-CORRECTIO Miodrag J. MihaljeviC ad Jova Dj. GoliC Istitute of Applied Mathematics ad Electroics. Belgrade School of Electrical Egieerig. Uiversity
More information