Sub-Exponential Algorithms for 0/1 Knapsack and Bin Packing

Size: px
Start display at page:

Download "Sub-Exponential Algorithms for 0/1 Knapsack and Bin Packing"

Transcription

1 Sub-Expoetial Algorithms for 0/1 Kapsack ad Bi Packig Thomas E. O Neil Computer Sciece Departmet Uiversity of North Dakota Grad Forks, ND, USA Abstract - This paper presets simple algorithms for 0/1 Kapsack ad Bi Packig with a fixed umber of bis that achieve time complexity p 2 O x where x is the total bit legth of a list of sizes for objects. The algorithms are adaptatios of a method that achieves a similar complexity for the Partitio ad Subset Sum problems. The method is show to be geeral eough to be applied to other optimizatio or decisio problem based o a list of umeric sizes or weights. This establishes that 0/1 Kapsack ad Bi Packig have sub-expoetial time complexity usig iput legth as the complexity parameter. It also supports the expectatio that all NP-complete problems with pseudo-polyomial time algorithms ca be solved determiistically i sub-expoetial time. Keywords: 0/1 Kapsack, dyamic programmig, Bi Packig, sub-expoetial time, NP-complete problems. 1 Itroductio The comparative complexity of problems withi the class NP-Complete has bee a recurrig theme i computer sciece research sice the problems were defied ad cataloged i the early years of the disciplie [2]. I 1990, Stears ad Hut [7] classified a problem to have power idex i if the fastest algorithm that solves it requires 2 O i steps. Assumig that Satisfiability has power idex 1, they argued that the Clique ad Partitio problems have power idex oe-half. Their aalysis is based o two algorithms with time complexity p 2 O x, where x is the legth i bits of the iput represetatios ad p() is a polyomial fuctio of the umber of graph edges (for Clique) or the umber of itegers i the iput set (for Partitio). These results were iterpreted to provide strog evidece that Clique ad Partitio were easier problems tha Satisfiability ad most other NP-Complete problems. I a subsequet study, Impagliazzo, Paturi, ad Zae [3] preseted aother framework for compariso of NPcomplete problems. Istead of adoptig the power idex termiology of Stears ad Hut, they categorized problems based o weakly expoetial ( 2 1 ) or strogly expoetial ( 2 ) lower bouds (assumig that Satisfiability will oe day be prove to be strogly expoetial) ad sub-expoetial ( 2 o ) upper bouds. To avoid icosistecies related to the characterizatio of iput legth, they defied a family of reductios (the Sub- Expoetial Reductio Family) that would allow the complexity measure to be parameterized. This framework tolerated polyomial differeces i the legths of problem istaces, ad there was o complexity distictio amog Clique, Idepedet Set, Vertex Cover or k-sat. These coclusios are ot cosistet with those of Stears ad Hut, where both Clique ad Partitio were easier tha Satisfiability. It is clear that represetatios ad complexity measures for problem istaces play a critical role i complexity aalysis. I classical complexity theory, the complexity measure is the legth of the iput strig. This parameter is formally determied, simply by coutig the bits i the strig. The advatage of usig the formal measure is that it requires o sematic iterpretatio of the iput strig, ad problems with vastly differet sematics ca by grouped together i formal complexity classes. Withi the class NP-complete, we fid that for may problems, the use of simple sematic complexity measures will ot clash with detailed aalysis based o the formal measure. This is geerally true of strog NP-complete problems, where the objects i the iput represetig variables or odes or set elemets ca be umbered (i biary). The umbers are just labels used for idetificatio of the objects. There are other problems i the class, however, where the iput cotais a list of weights or values, ad aalysis based o sematic measures such as the umber of objects versus the sum (or maximum) of the values ca give radically differet results: expoetial time with oe measure, polyomial time with the other. This collectio of problems icludes Partitio, Subset Sum, 0/1 Kapsack, ad Bi Packig, which we will refer to as the Subset Sum family. The safest approach to aalysis of these problems is to use the formal complexity measure, which icorporates both relevat sematic parameters, ad i this paper we show that the Subset Sum family of pseudopolyomial-time problems is 2 O x (which is subexpoetial).

2 Stears ad Hut [7] were apparetly the first to demostrate that a algorithm for the Partitio problem exhibits sub-expoetial time. The sigificace of this result was probably obscured by the claim i the same paper that the Clique problem is also sub-expoetial, while its dual problem Idepedet Set remais strogly expoetial. This apparet aomaly is a represetatio-depedet distictio, ad it disappears whe a symmetric represetatio for the problem istace is used [5]. The complexity distictio betwee Partitio ad Satisfiability, however, appears to have stroger credibility. I [6] it is show that the sub-expoetial upper boud for Partitio is also valid for Subset Sum. The algorithm for Subset Sum is a variat of dyamic programmig that is much simpler ad more geeral tha the backtrackig/dyamic programmig hybrid that Stears ad Hut desiged for Partitio. I this paper, the sub-expoetial Subset Sum algorithm is adapted to 0/1 Kapsack ad Bi Packig with a fixed umber of bis, establishig that these problems are also subexpoetial with respect to the formal complexity measure (total bit-legth of iput, deoted x). We also abstract from the previous methods a lemma that idetifies the property of ordered sets of itegers that is exploited to achieve subexpoetial time. More recet complexity studies i the research literature for problems i the Subset Sum family do ot typically use the iput legth as the complexity parameter. The curret upper boud for both Subset Sum ad 0/1 Kapsack is apparetly 2 O /2 whe the umber of objects i the list is used as the complexity measure [8]. A lower boud of 2 /2 / for Kapsack has also bee demostrated i [1]. The lower boud applies oly to algorithms withi a model defied geerally eough to iclude most backtrackig ad dyamic programmig approaches. The sub-expoetial bouds derived here usig the formal complexity measure complemet rather tha supersede the strogly expoetial bouds derived usig the umber of objects i the iput list (deoted ) as the complexity parameter. 2 Geeralized Dyamic Programmig The Stears ad Hut algorithm for Partitio [7] combies backtrackig with dyamic programmig. Such hybrid approaches had bee previously described i operatios research literature (e.g. [4]). The iput set is ordered ad divided ito a deser ad a sparser subset. Backtrackig is employed o the sparse subset, while dyamic programmig is used for the dese subset. The results are combied to achieve time complexity 2 O x, where x is the total legth i bits of the iput. I this paper we employ a simpler algorithm that achieves the same goal. The approach was first developed for Subset Sum ad Partitio [6]. Similar to covetioal dyamic programmig, it represets a breadth-first eumeratio of partial solutios. The problem istace is a list of objects, each of which has a size. The algorithm maitais a pool of partial solutios as it processes each object. The list of objects is ordered by size, ad the largest objects are processed first. I cotrast with covetioal dyamic programmig, the pool of solutios is dyamically allocated (hece the acroym DDP, for dyamic dyamic programmig). It first grows ad the shriks as more objects are processed. The etire pool of solutios is traversed for each object, updatig each solutio by possibly subtractig the curret object's size from the solutio's remaiig capacity. Each solutio is also evaluated relative to the sum of sizes of the objects yet to be processed. The sum of remaiig sizes ca be used to prue the pool of solutios depedig o problem sematics. This pruig relative to the sum of sizes of the uprocessed objects places a sub-expoetial upper boud o the umber of partial solutios i the pool. The time aalysis of the DDP method relies o a simple lemma (abstracted from the aalysis i [6]) that allows us to boud the k th value i a ordered list as a fuctio of its positio i the list ad the total bit-legth of the etire list (see Lemma 1 below). Boudig the k th value allows us to boud the sum of the first k values as well. This, i tur, leads to a boud o the legth of the pool of partial solutios i DDP algorithms. Lemma 1: Let L represet a list of positive atural umbers i o-decreasig order, let L[k] represet the k th umber i the list, let b k be the bit legth of the k th umber, ad let b be total umber of bits i the etire list: b = b i = 1 lg L[i]. The L[k] < 2 (b k+1)/( k+1)+1. Proof: A upper boud o the value of L[k] for ay list with total bit legth b is obtaied by reservig as few bits as possible for the smaller umbers i the list ad as may bits as possible for L[k] ad the umbers that follow it. This is accomplished by settig L[1] through L[k-1] to 1 ad distributig the remaiig bits equally amog the higher k + 1 umbers. I that case, L[k] has o more tha (b k+1)/ ( k+1) bits, establishig L[k] < 2 (b k+1)/( k+1)+1. 3 The Kapsack Problem The 0/1 Kapsack problem is defied as follows: give a set of objects S with sizes s[1..] ad values v[1..], fid a subset of objects with the highest value whose size is less tha or equal to C, the capacity of the kapsack [2]. The problem ca also be expressed as a decisio problem, where we determie the existece of a subset whose value is greater tha or equal to a target value V.

3 //* Give a set of objects whose sizes are specified i a array s[1..] i o-decreasig order ad whose values are stored i a array v[1..], fid the highest valued subset whose total size is less tha or equal to capacity C. */ public it Kapsack() 1) bestval 0; 2) sizeofrest 3.1 The Kapsack algorithm s[ i] ; valueofrest v[i] ; 3) Pool {(C, 0)}; 4) for i 1 to 5) size s[ i +1]; value v[ i +1]; 6) NewList { }; 7) for each sack i Pool 8) if (sack.capacity < size ) 9) cotiue; 10) else if (sack.capacity > sizeofrest) 11) bestval max (bestval, sack.value + valueofrest) 12) remove sack from Pool; 13) else 14) bestval max (bestval, sack.value + value); 15) NewList.apped ((sack.capacity size, sack.value + value)); ed for 16) sizeofrest sizeofrest size; valueofrest valueofrest value; 17) Pool merge(pool, NewList); ed for 18) retur bestval; Figure 1. The Kapsack algorithm. I adaptig the DDP method to the Kapsack problem, we ca iterate either the size or the value array as the cotrol for the outer loop. Here we use the size array. The algorithm keeps a pool of (capacity, value) pairs represetig partially filled kapsacks, iitially cotaiig a empty sack represeted as (C, 0), where C is the capacity of the empty sack. For each object i S ad for each sack curretly i the pool, we add a ew sack represetig the curret sack plus the curret object. This is accomplished by subtractig the object size from the sack's remaiig capacity ad addig the object value to the sack's value. Pseudo-code for the Kapsack algorithm is show i Figure 1. Lies 1-3 iitialize the global Pool, the bestval variable, ad variables represetig the cumulative size ad value of the remaiig objects. There is oe iteratio of the outer for loop (lies 4-17) for each object i the set S = {y 1, y 2,..., y }. The size array s, i which s[i] is the size of object y i, is assumed to be i o-decreasig order, ad the largest umbers are processed first, so object y i+1 is processed durig the i th iteratio. The pool of partially filled sacks is updated by the ier for loop (lies 7-15). For each sack i the pool, s[ i+1] is subtracted from its capacity ad v[ i+1] is added to its value, placig the ew (capacity, value) o a secod ordered sack list. The pool ad the ew sack list are merged i the last step of the outer loop (lie 17). The best value for a filled sack is updated whe appropriate i lies 11 ad 14, wheever a updated sack is created. At completio of the outer loop, the best value is retured. The algorithm does ot retur the cotets of the sack with the best value, but this could be accomplished by addig a referece to a subset object to the (capacity, value) pairs i the pool, icreasig the time complexity by o more tha a factor of. The ier loop has two coditios that moderate the legth of the pool. Lies 8 ad 9 skip sacks that ca't hold the curret object. Also, i lies 10-12, sacks with eough capacity to hold all remaiig objects are removed from the pool after updatig the bestval variable. If all remaiig objects will fit i a sack, there is o process them oe-byoe. The outer loop also has logic to cotrol the size of the pool. The last step i the outer loop is a sequetial merge operatio that adds the ew partially filled sacks to the pool. If two sacks with the same capacity are ecoutered durig the merge, oly the sack with the higher value is added to the pool. Thus the capacities of all sacks i the pool are uique. 3.2 Time Aalysis of Kapsack The time aalysis closely follows the method used for the Subset Sum algorithm i [6]. Let S = {y 1, y 2,..., y } ad assume the sizes are stored i o-decreasig order (s[i] s[i+1]). The total umber of steps is determied by the size of Pool. With each iteratio of the outer for loop, Pool is traversed ad possibly exteded (requirig 2 passes oe by the ier for loop ad the other by the sequetial merge step). The total amout of work is closely estimated (withi a factor of 2) by Pool i (1) where Pool i is the legth of Pool at the begiig of outer loop iteratio i. Sice the merge operatio elimiates duplicatio of capacities, we ca describe legth of Pool(i) as at most MaxC(i), the largest capacity of ay sack o the list at the begiig of iteratio i. The list is actually smaller tha this, sice all the capacities betwee zero ad the maximum are ot preset. We also kow that the legth of the list ca, at most, double with each loop iteratio, so regardless

4 of the maximum value i the list, its legth caot exceed 2 i. This gives us Pool i mi 2 i, MaxC i. (2) The legth of Pool will grow rapidly ad later possibly shrik as i approaches. Our goal is to fid a upper boud for MaxC(i). Iitially MaxC(1) = C, which is the capacity of the empty sack. Oly smaller-capacity sacks are added to the list, ad evetually the larger-capacity sacks are removed whe the coditio i lie 10 becomes true, so i 1 MaxC i s [ j] i 1 s[ i 1]. (3) j=1 Boudig MaxC(i) thus reduces to fidig a upper boud for s[ i + 1], ad Lemma 1 is ivoked for this purpose. To complete the aalysis, we boud the step couts as a fuctio of b, the total bit legth of the size array s. We cosider two cases. Case 1. b. Here we have Pool i mi 2 i, MaxC i 2 b. (4) Case 2. > b. I this case we split the summatio at i = b. b 1 Pool i mi 2 i, MaxC i (5) mi 2 i, MaxC i mi 2 i,maxc i (6) i= b b 1 2 b 1 mi 2 i, MaxC i (7) i= b b 1 2 b 1 b 1 MaxC b (8) b 1 b 1 2 b 1 b 1 j=1 s[ j]. (9) b 1 2 b 1 b 1 2 s[ b 1] (10) At this poit, we employ Lemma 1 to compute the boud for s[k] where k= b 1, ad we cotiue by replacig s [ b 1] with 2 b 1 : b 1 2 b 1 b b 1 (11) b b 1 (12) b. (13) This establishes that the time complexity of Kapsack is O p 2 b for a polyomial fuctio p(). The argumet b is the total bit legth of the list of sizes. The etire iput for the problem also icludes the capacity C ad a list of values. We ca't make ay specific assumptios about the relative magitudes of the sizes ad values, but we are certai that if x is the total iput legth, the b will be smaller tha x, ad the O p 2 b step cout will also be O p 2 x. 4 The Bi Packig Problem The Bi Packig problem is defied as follows: give a set of objects S with sizes s[1..], determie whether the objects will fit ito a fixed umber of k bis, each with a capacity of B. The problem ca also be expressed as a optimizatio problem i which the smallest B is determied [2]. Whe B is equal to the sum of all sizes divided by k, the problem represets a geeralizatio of the Partitio problem. /* Give a set of objects whose sizes are specified i a array s[1..] i o-decreasig order, determie whether all objects ca be stored i k bis, each with capacity B. */ public boolea BiPack() 1) sizeofrest = s[i] ; 2) Pool = {(B, B,, B)}; 3) for i 1 to 4) extsize s[ i +1]; 5) NewList { }; 6) for each bituple i Pool 7) if (bituple.capacity[1] < extsize ) 8) cotiue; 9) else if (bituple.capacity[1] > sizeofrest) 10) retur true; 11) else 12) for j 1 to k 13) ewtuple update(bituple, j, extsize); 14) if (ewtuple!= ull) 15) NewList.isert (ewtuple); ed for ed for 16) Pool NewList; 17) sizeofrest sizeofrest extsize; ed for 18) retur false; Figure 2. The BiPack algorithm. 4.1 The BiPack Algorithm Whe we adapt the DDP strategy to Bi Packig, we fid a few sigificat differeces from the Kapsack versio. The BiPack algorithm is show i Figure 2. The pool of partial solutios must be a list of k-tuples, where each compoet of a tuple is the remaiig capacity of oe of the bis (see lie 2). Also, we are ot searchig for a subset. All the objects i the origial set S must be icluded i the solutio. This has implicatios for the logic i the ested loops of the algorithm. Ay partial solutio i the ier loop that caot accommodate the ext object ca be

5 discarded (lies 7-8), ad the pool of updated partial solutios created by the ier loop replaces the pool from the previous iteratio of the outer loop (rather tha mergig with the previous pool; see lie 16). We also fid that the test eforcig the upper limit o the size of the pool (relative to the sum of the remaiig object sizes) triggers early termiatio (lies 9-10). This versio of the algorithm does ot specify what objects are placed i what bis, but this iformatio could be icluded by associatig a referece to a size object to each partial solutio. This would icrease the time complexity by o more tha a factor of. 4.2 Time Aalysis of BiPack The time aalysis of BiPack follows the same geeral logic as the aalysis for Kapsack. The major differece is the growth rate of the pool of partial solutios. While the pool ca double i legth with each iteratio of the ier loop i Kapsack, it ca icrease i legth by a factor of k i BiPack. Aother sigificat differece is the cost of suppressig duplicates i the pool of partial solutios. We make the coservative assumptio that the isertio of a updated partial solutio i the pool takes liear time i the curret legth of the pool. We demostrate below that i spite of these sigificat differeces, the time complexity of the algorithm remais sub-expoetial. To proceed with the aalysis, let S = {y 1, y 2,..., y }, ad assume the sizes are stored i o-decreasig order (s[i] s[i+1]). As with Kapsack, The total umber of steps is closely related to the size of Pool. With each iteratio of the outer for loop, Pool is traversed ad replaced with a updated versio (called NewList). Each isertio ito NewList requires liear time. The total amout of work is therefore estimated as Pool i 2 (14) where Pool i is the legth of Pool at the begiig of outer loop iteratio i. Sice the isert operatio of lie 15 elimiates duplicatio of capacities, we ca describe legth of Pool(i) as at most MaxC(i) k. If MaxC(i) is the largest capacity of ay bi i ay tuple o the list at the begiig of iteratio i, the umber of distict tuples caot exceed this quatity raised to the power k. This grossly overestimates the umber of tuples, sice the capacities withi each tuple are i o-icreasig order ad sice all the tuples have the same sum. It is a iterestig coutig problem to determie a tight upper boud for the umber of tuples, but the loose boud is sufficiet to establish the desired complexity result. We also kow that the legth of the list ca, at most, grow by a factor of k with each loop iteratio, so regardless of the maximum value i the list, its legth caot exceed k i. This gives us Pool i mi k i, MaxC i k. (15) Lies 9 ad 10 assure us that the algorithm termiates if MaxC(i) exceeds the sum of the remaiig object sizes, so we have i 1 MaxC i s [ j] i 1 s[ i 1]. (16) j=1 To complete the aalysis, we boud the step couts as a fuctio of x, the total bit legth of the size array s. As before, we cosider two cases. Case 1. x. Here we have Pool i 2 mi k i,maxc i k 2 (17) k 2 k 2 x 2 2lg k x. (18) Case 2. > x. I this case we split the summatio at i = x. Pool i 2 mi k i,maxc i k 2 (19) x 1 mi k i, MaxC i k 2 i= x mi k i, MaxC i k 2 (20) x 1 k x 1 x 1 MaxC x k 2 (21) The by Lemma 1: x 1 k x 1 x 1 x 1 2 x 1 2k (22) ad by algebraic simplificatio: 2k 1 2 2k x 1 (23) Sice k is a costat, this establishes that the time complexity of BiPack is p 2 O x for a polyomial fuctio p(). 5 Coclusio The algorithms i the previous sectios demostrate that dyamic programmig with dyamic allocatio (DDP) ca be used to prove that 0/1 Kapsack ad Bi Packig with a fixed umber of bis have time complexity p 2 O x where x is the total bit legth of iput umbers. This places these problems with Partitio ad Subset Sum i the subclass of NP-complete problems that have sub-expoetial upper bouds o ruig time, whe iput legth is used as the complexity parameter. The Kapsack problem was formulated as a optimizatio problem above, while Bi Packig was preseted as a decisio problem. It is apparet that the Kapsack algorithm ca be modified to solve the decisio versio of the problem without chagig its time complexity. It is also possible to modify BiPack to fid the smallest bi capacity eeded to store all objects i k bis, as log as k is costat, without chagig its time complexity. Give the simplicity ad geerality of Lemma

6 1, which provides the foudatio for the time aalyses, we expect that the DDP method ca be applied to ay NPcomplete problem ivolvig a list of weighted objects that has pseudo-polyomial time complexity. Refereces [1] M. Alekhovich, A. Borodi, J. Buresh-Oppeheim, R. Impagliazzo, A. Mage, ad T. Pitassi, Toward a Model for Backtrackig ad Dyamic Programmig, Proceedigs of the 20 th Aual IEEE Coferece o Computatioal Complexity, pp (2005). [2] M. Garey ad D. Johso, Computers ad Itractability: A Guide to the Theory of NP- Completeess, Freema Press, Sa Fracisco, CA (1979). [3] R. Impagliazzo, R. Paturi, ad F. Zae, Which Problems Have Strogly Expoetial Complexity?, Joural of Computer ad System Scieces 63, pp , Elsevier Sciece (2001). [4] S. Martello ad P. Toth, A mixture of dyamic programmig ad brach-ad-boud for the subset sum problem, Maagemet Sciece 30(6), pp (1984). [5] T. E. O'Neil, The Importace of Symmetric Represetatio, Proceedigs of the 2009 Iteratioal Coferece o Foudatios of Computer Sciece (FCS 2009), pp , CSREA Press (2009). O [6] T. E. O'Neil ad S. Kerli, A Simple x 2 Algorithm for Partitio ad Subset Sum, Proceedigs of the 2010 Iteratioal Coferece o Foudatios of Computer Sciece (FCS 2010), pp , CSREA Press (2010). [7] R. Stears ad H. Hut, Power Idices ad Easier Hard Problems, Mathematical Systems Theory 23 (1990), pp [8] G. J. Woegiger, Exact Algorithms for NP-Hard Problems: A Survey, Lecture Notes i Computer Sciece 2570, pp , Spriger-Verlaug, Berli (2003).

6.854J / J Advanced Algorithms Fall 2008

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

Lecture 5. Counting Sort / Radix Sort

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

condition w i B i S maximum u i

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

Homework 1 Solutions MA 522 Fall 2017

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

What are we going to learn? CSC Data Structures Analysis of Algorithms. Overview. Algorithm, and Inputs

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

Counting the Number of Minimum Roman Dominating Functions of a Graph

Counting 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

Analysis Metrics. Intro to Algorithm Analysis. Slides. 12. Alg Analysis. 12. Alg Analysis

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

Lecture Notes 6 Introduction to algorithm analysis CSS 501 Data Structures and Object-Oriented Programming

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

Ones Assignment Method for Solving Traveling Salesman Problem

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

CIS 121 Data Structures and Algorithms with Java Spring Stacks, Queues, and Heaps Monday, February 18 / Tuesday, February 19

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

Hash Tables. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015.

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

Basic allocator mechanisms The course that gives CMU its Zip! Memory Management II: Dynamic Storage Allocation Mar 6, 2000.

Basic allocator mechanisms The course that gives CMU its Zip! Memory Management II: Dynamic Storage Allocation Mar 6, 2000. 5-23 The course that gives CM its Zip Memory Maagemet II: Dyamic Storage Allocatio Mar 6, 2000 Topics Segregated lists Buddy system Garbage collectio Mark ad Sweep Copyig eferece coutig Basic allocator

More information

Chapter 11. Friends, Overloaded Operators, and Arrays in Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved.

Chapter 11. Friends, Overloaded Operators, and Arrays in Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved. Chapter 11 Frieds, Overloaded Operators, ad Arrays i Classes Copyright 2014 Pearso Addiso-Wesley. All rights reserved. Overview 11.1 Fried Fuctios 11.2 Overloadig Operators 11.3 Arrays ad Classes 11.4

More information

Algorithm. Counting Sort Analysis of Algorithms

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

. Written in factored form it is easy to see that the roots are 2, 2, i,

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

A New Morphological 3D Shape Decomposition: Grayscale Interframe Interpolation Method

A New Morphological 3D Shape Decomposition: Grayscale Interframe Interpolation Method A ew Morphological 3D Shape Decompositio: Grayscale Iterframe Iterpolatio Method D.. Vizireau Politehica Uiversity Bucharest, Romaia ae@comm.pub.ro R. M. Udrea Politehica Uiversity Bucharest, Romaia mihea@comm.pub.ro

More information

Sorting in Linear Time. Data Structures and Algorithms Andrei Bulatov

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

n n B. How many subsets of C are there of cardinality n. We are selecting elements for such a

n n B. How many subsets of C are there of cardinality n. We are selecting elements for such a 4. [10] Usig a combiatorial argumet, prove that for 1: = 0 = Let A ad B be disjoit sets of cardiality each ad C = A B. How may subsets of C are there of cardiality. We are selectig elemets for such a subset

More information

How do we evaluate algorithms?

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

Outline and Reading. Analysis of Algorithms. Running Time. Experimental Studies. Limitations of Experiments. Theoretical Analysis

Outline and Reading. Analysis of Algorithms. Running Time. Experimental Studies. Limitations of Experiments. Theoretical Analysis Outlie ad Readig Aalysis of Algorithms Iput Algorithm Output Ruig time ( 3.) Pseudo-code ( 3.2) Coutig primitive operatios ( 3.3-3.) Asymptotic otatio ( 3.6) Asymptotic aalysis ( 3.7) Case study Aalysis

More information

The isoperimetric problem on the hypercube

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

CIS 121 Data Structures and Algorithms with Java Fall Big-Oh Notation Tuesday, September 5 (Make-up Friday, September 8)

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

The Magma Database file formats

The Magma Database file formats The Magma Database file formats Adrew Gaylard, Bret Pikey, ad Mart-Mari Breedt Johaesburg, South Africa 15th May 2006 1 Summary Magma is a ope-source object database created by Chris Muller, of Kasas City,

More information

Chapter 8. Strings and Vectors. Copyright 2014 Pearson Addison-Wesley. All rights reserved.

Chapter 8. Strings and Vectors. Copyright 2014 Pearson Addison-Wesley. All rights reserved. Chapter 8 Strigs ad Vectors Overview 8.1 A Array Type for Strigs 8.2 The Stadard strig Class 8.3 Vectors Slide 8-3 8.1 A Array Type for Strigs A Array Type for Strigs C-strigs ca be used to represet strigs

More information

1.2 Binomial Coefficients and Subsets

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

Exact Minimum Lower Bound Algorithm for Traveling Salesman Problem

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

1 Graph Sparsfication

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

CSE 417: Algorithms and Computational Complexity

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

Combination Labelings Of Graphs

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

Computational Geometry

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

CSC165H1 Worksheet: Tutorial 8 Algorithm analysis (SOLUTIONS)

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

CIS 121 Data Structures and Algorithms with Java Spring Stacks and Queues Monday, February 12 / Tuesday, February 13

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

Chapter 8. Strings and Vectors. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 8. Strings and Vectors. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 8 Strigs ad Vectors Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 8.1 A Array Type for Strigs 8.2 The Stadard strig Class 8.3 Vectors Copyright 2015 Pearso Educatio, Ltd..

More information

Lecture 6. Lecturer: Ronitt Rubinfeld Scribes: Chen Ziv, Eliav Buchnik, Ophir Arie, Jonathan Gradstein

Lecture 6. Lecturer: Ronitt Rubinfeld Scribes: Chen Ziv, Eliav Buchnik, Ophir Arie, Jonathan Gradstein 068.670 Subliear Time Algorithms November, 0 Lecture 6 Lecturer: Roitt Rubifeld Scribes: Che Ziv, Eliav Buchik, Ophir Arie, Joatha Gradstei Lesso overview. Usig the oracle reductio framework for approximatig

More information

Lecturers: Sanjam Garg and Prasad Raghavendra Feb 21, Midterm 1 Solutions

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

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 19 Query Optimizatio Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe Itroductio Query optimizatio Coducted by a query optimizer i a DBMS Goal:

More information

Lower Bounds for Sorting

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

Running Time. Analysis of Algorithms. Experimental Studies. Limitations of Experiments

Running Time. Analysis of Algorithms. Experimental Studies. Limitations of Experiments Ruig Time Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects. The

More information

Pseudocode ( 1.1) Analysis of Algorithms. Primitive Operations. Pseudocode Details. Running Time ( 1.1) Estimating performance

Pseudocode ( 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 information

University of Waterloo Department of Electrical and Computer Engineering ECE 250 Algorithms and Data Structures

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

COSC 1P03. Ch 7 Recursion. Introduction to Data Structures 8.1

COSC 1P03. Ch 7 Recursion. Introduction to Data Structures 8.1 COSC 1P03 Ch 7 Recursio Itroductio to Data Structures 8.1 COSC 1P03 Recursio Recursio I Mathematics factorial Fiboacci umbers defie ifiite set with fiite defiitio I Computer Sciece sytax rules fiite defiitio,

More information

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

why study sorting? Sorting is a classic subject in computer science. There are three reasons for studying sorting algorithms.

why study sorting? Sorting is a classic subject in computer science. There are three reasons for studying sorting algorithms. Chapter 5 Sortig IST311 - CIS65/506 Clevelad State Uiversity Prof. Victor Matos Adapted from: Itroductio to Java Programmig: Comprehesive Versio, Eighth Editio by Y. Daiel Liag why study sortig? Sortig

More information

Graphs. Minimum Spanning Trees. Slides by Rose Hoberman (CMU)

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

CIS 121. Introduction to Trees

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

Running Time ( 3.1) Analysis of Algorithms. Experimental Studies. Limitations of Experiments

Running Time ( 3.1) Analysis of Algorithms. Experimental Studies. Limitations of Experiments Ruig Time ( 3.1) Aalysis of Algorithms Iput Algorithm Output A algorithm is a step- by- step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects.

More information

Analysis of Algorithms

Analysis of Algorithms Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Ruig Time Most algorithms trasform iput objects ito output objects. The

More information

An Improved Shuffled Frog-Leaping Algorithm for Knapsack Problem

An Improved Shuffled Frog-Leaping Algorithm for Knapsack Problem A Improved Shuffled Frog-Leapig Algorithm for Kapsack Problem Zhoufag Li, Ya Zhou, ad Peg Cheg School of Iformatio Sciece ad Egieerig Hea Uiversity of Techology ZhegZhou, Chia lzhf1978@126.com Abstract.

More information

Analysis of Algorithms

Analysis of Algorithms Aalysis of Algorithms Ruig Time of a algorithm Ruig Time Upper Bouds Lower Bouds Examples Mathematical facts Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite

More information

On (K t e)-saturated Graphs

On (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 information

Chapter 1. Introduction to Computers and C++ Programming. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 1. Introduction to Computers and C++ Programming. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 1 Itroductio to Computers ad C++ Programmig Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 1.1 Computer Systems 1.2 Programmig ad Problem Solvig 1.3 Itroductio to C++ 1.4 Testig

More information

CS211 Fall 2003 Prelim 2 Solutions and Grading Guide

CS211 Fall 2003 Prelim 2 Solutions and Grading Guide CS11 Fall 003 Prelim Solutios ad Gradig Guide Problem 1: (a) obj = obj1; ILLEGAL because type of referece must always be a supertype of type of object (b) obj3 = obj1; ILLEGAL because type of referece

More information

3. b. Present a combinatorial argument that for all positive integers n : : 2 n

3. b. Present a combinatorial argument that for all positive integers n : : 2 n . b. Preset a combiatorial argumet that for all positive itegers : : Cosider two distict sets A ad B each of size. Sice they are distict, the cardiality of A B is. The umber of ways of choosig a pair of

More information

Recursion. Recursion. Mathematical induction: example. Recursion. The sum of the first n odd numbers is n 2 : Informal proof: Principle:

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

Data Structures and Algorithms. Analysis of Algorithms

Data Structures and Algorithms. Analysis of Algorithms Data Structures ad Algorithms Aalysis of Algorithms Outlie Ruig time Pseudo-code Big-oh otatio Big-theta otatio Big-omega otatio Asymptotic algorithm aalysis Aalysis of Algorithms Iput Algorithm Output

More information

Big-O Analysis. Asymptotics

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

15-859E: Advanced Algorithms CMU, Spring 2015 Lecture #2: Randomized MST and MST Verification January 14, 2015

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

Computers and Scientific Thinking

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

Python Programming: An Introduction to Computer Science

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

A graphical view of big-o notation. c*g(n) f(n) f(n) = O(g(n))

A graphical view of big-o notation. c*g(n) f(n) f(n) = O(g(n)) ca see that time required to search/sort grows with size of We How do space/time eeds of program grow with iput size? iput. time: cout umber of operatios as fuctio of iput Executio size operatio Assigmet:

More information

Sum-connectivity indices of trees and unicyclic graphs of fixed maximum degree

Sum-connectivity indices of trees and unicyclic graphs of fixed maximum degree 1 Sum-coectivity idices of trees ad uicyclic graphs of fixed maximum degree Zhibi Du a, Bo Zhou a *, Nead Triajstić b a Departmet of Mathematics, South Chia Normal Uiversity, uagzhou 510631, Chia email:

More information

Chapter 9. Pointers and Dynamic Arrays. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 9. Pointers and Dynamic Arrays. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 9 Poiters ad Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 9.1 Poiters 9.2 Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Slide 9-3

More information

Speeding-up dynamic programming in sequence alignment

Speeding-up dynamic programming in sequence alignment Departmet of Computer Sciece Aarhus Uiversity Demark Speedig-up dyamic programmig i sequece aligmet Master s Thesis Dug My Hoa - 443 December, Supervisor: Christia Nørgaard Storm Pederse Implemetatio code

More information

Octahedral Graph Scaling

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

ECE4050 Data Structures and Algorithms. Lecture 6: Searching

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

Data Structures Week #9. Sorting

Data Structures Week #9. Sorting Data Structures Week #9 Sortig Outlie Motivatio Types of Sortig Elemetary (O( 2 )) Sortig Techiques Other (O(*log())) Sortig Techiques 21.Aralık.2010 Boraha Tümer, Ph.D. 2 Sortig 21.Aralık.2010 Boraha

More information

Minimum Spanning Trees

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

Heuristic Approaches for Solving the Multidimensional Knapsack Problem (MKP)

Heuristic Approaches for Solving the Multidimensional Knapsack Problem (MKP) Heuristic Approaches for Solvig the Multidimesioal Kapsack Problem (MKP) R. PARRA-HERNANDEZ N. DIMOPOULOS Departmet of Electrical ad Computer Eg. Uiversity of Victoria Victoria, B.C. CANADA Abstract: -

More information

An Efficient Algorithm for Graph Bisection of Triangularizations

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

Elementary Educational Computer

Elementary Educational Computer Chapter 5 Elemetary Educatioal Computer. Geeral structure of the Elemetary Educatioal Computer (EEC) The EEC coforms to the 5 uits structure defied by vo Neuma's model (.) All uits are preseted i a simplified

More information

A New Bit Wise Technique for 3-Partitioning Algorithm

A New Bit Wise Technique for 3-Partitioning Algorithm Special Issue of Iteratioal Joural of Computer Applicatios (0975 8887) o Optimizatio ad O-chip Commuicatio, No.1. Feb.2012, ww.ijcaolie.org A New Bit Wise Techique for 3-Partitioig Algorithm Rajumar Jai

More information

CS200: Hash Tables. Prichard Ch CS200 - Hash Tables 1

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

Analysis of Algorithms

Analysis of Algorithms Presetatio for use with the textbook, Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 2015 Aalysis of Algorithms Iput 2015 Goodrich ad Tamassia Algorithm Aalysis of Algorithms

More information

3D Model Retrieval Method Based on Sample Prediction

3D Model Retrieval Method Based on Sample Prediction 20 Iteratioal Coferece o Computer Commuicatio ad Maagemet Proc.of CSIT vol.5 (20) (20) IACSIT Press, Sigapore 3D Model Retrieval Method Based o Sample Predictio Qigche Zhag, Ya Tag* School of Computer

More information

Perhaps the method will give that for every e > U f() > p - 3/+e There is o o-trivial upper boud for f() ad ot eve f() < Z - e. seems to be kow, where

Perhaps the method will give that for every e > U f() > p - 3/+e There is o o-trivial upper boud for f() ad ot eve f() < Z - e. seems to be kow, where ON MAXIMUM CHORDAL SUBGRAPH * Paul Erdos Mathematical Istitute of the Hugaria Academy of Scieces ad Reu Laskar Clemso Uiversity 1. Let G() deote a udirected graph, with vertices ad V(G) deote the vertex

More information

arxiv: v2 [cs.ds] 24 Mar 2018

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

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 18 Strategies for Query Processig Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe Itroductio DBMS techiques to process a query Scaer idetifies

More information

Adaptive Resource Allocation for Electric Environmental Pollution through the Control Network

Adaptive Resource Allocation for Electric Environmental Pollution through the Control Network Available olie at www.sciecedirect.com Eergy Procedia 6 (202) 60 64 202 Iteratioal Coferece o Future Eergy, Eviromet, ad Materials Adaptive Resource Allocatio for Electric Evirometal Pollutio through the

More information

Chapter 24. Sorting. Objectives. 1. To study and analyze time efficiency of various sorting algorithms

Chapter 24. Sorting. Objectives. 1. To study and analyze time efficiency of various sorting algorithms Chapter 4 Sortig 1 Objectives 1. o study ad aalyze time efficiecy of various sortig algorithms 4. 4.7.. o desig, implemet, ad aalyze bubble sort 4.. 3. o desig, implemet, ad aalyze merge sort 4.3. 4. o

More information

Minimum Spanning Trees

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

DATA STRUCTURES. amortized analysis binomial heaps Fibonacci heaps union-find. Data structures. Appetizer. Appetizer

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

CS 683: Advanced Design and Analysis of Algorithms

CS 683: Advanced Design and Analysis of Algorithms CS 683: Advaced Desig ad Aalysis of Algorithms Lecture 6, February 1, 2008 Lecturer: Joh Hopcroft Scribes: Shaomei Wu, Etha Feldma February 7, 2008 1 Threshold for k CNF Satisfiability I the previous lecture,

More information

Big-O Analysis. Asymptotics

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

Minimum Spanning Trees. Application: Connecting a Network

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

BASED ON ITERATIVE ERROR-CORRECTION

BASED 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

c-dominating Sets for Families of Graphs

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

Xiaozhou (Steve) Li, Atri Rudra, Ram Swaminathan. HP Laboratories HPL Keyword(s): graph coloring; hardness of approximation

Xiaozhou (Steve) Li, Atri Rudra, Ram Swaminathan. HP Laboratories HPL Keyword(s): graph coloring; hardness of approximation Flexible Colorig Xiaozhou (Steve) Li, Atri Rudra, Ram Swamiatha HP Laboratories HPL-2010-177 Keyword(s): graph colorig; hardess of approximatio Abstract: Motivated b y reliability cosideratios i data deduplicatio

More information

An Efficient Algorithm for Graph Bisection of Triangularizations

An Efficient Algorithm for Graph Bisection of Triangularizations Applied Mathematical Scieces, Vol. 1, 2007, o. 25, 1203-1215 A Efficiet Algorithm for Graph Bisectio of Triagularizatios Gerold Jäger Departmet of Computer Sciece Washigto Uiversity Campus Box 1045, Oe

More information

Improved Random Graph Isomorphism

Improved Random Graph Isomorphism Improved Radom Graph Isomorphism Tomek Czajka Gopal Paduraga Abstract Caoical labelig of a graph cosists of assigig a uique label to each vertex such that the labels are ivariat uder isomorphism. Such

More information

APPLICATION NOTE PACE1750AE BUILT-IN FUNCTIONS

APPLICATION NOTE PACE1750AE BUILT-IN FUNCTIONS APPLICATION NOTE PACE175AE BUILT-IN UNCTIONS About This Note This applicatio brief is iteded to explai ad demostrate the use of the special fuctios that are built ito the PACE175AE processor. These powerful

More information

FREQUENCY ESTIMATION OF INTERNET PACKET STREAMS WITH LIMITED SPACE: UPPER AND LOWER BOUNDS

FREQUENCY ESTIMATION OF INTERNET PACKET STREAMS WITH LIMITED SPACE: UPPER AND LOWER BOUNDS FREQUENCY ESTIMATION OF INTERNET PACKET STREAMS WITH LIMITED SPACE: UPPER AND LOWER BOUNDS Prosejit Bose Evagelos Kraakis Pat Mori Yihui Tag School of Computer Sciece, Carleto Uiversity {jit,kraakis,mori,y

More information

Recursion. Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Review: Method Frames

Recursion. Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Review: Method Frames Uit 4, Part 3 Recursio Computer Sciece S-111 Harvard Uiversity David G. Sulliva, Ph.D. Review: Method Frames Whe you make a method call, the Java rutime sets aside a block of memory kow as the frame of

More information

A Generalized Set Theoretic Approach for Time and Space Complexity Analysis of Algorithms and Functions

A Generalized Set Theoretic Approach for Time and Space Complexity Analysis of Algorithms and Functions Proceedigs of the 10th WSEAS Iteratioal Coferece o APPLIED MATHEMATICS, Dallas, Texas, USA, November 1-3, 2006 316 A Geeralized Set Theoretic Approach for Time ad Space Complexity Aalysis of Algorithms

More information

Examples and Applications of Binary Search

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 information

Lecture 1: Introduction and Strassen s Algorithm

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

Algorithm Efficiency

Algorithm Efficiency Algorithm Effiiey Exeutig ime Compariso of algorithms to determie whih oe is better approah implemet algorithms & reord exeutio time Problems with this approah there are may tasks ruig ourretly o a omputer

More information

Morgan Kaufmann Publishers 26 February, COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. Chapter 5

Morgan Kaufmann Publishers 26 February, COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. Chapter 5 Morga Kaufma Publishers 26 February, 28 COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Iterface 5 th Editio Chapter 5 Set-Associative Cache Architecture Performace Summary Whe CPU performace icreases:

More information

9.1. Sequences and Series. Sequences. What you should learn. Why you should learn it. Definition of Sequence

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

Civil Engineering Computation

Civil Engineering Computation Civil Egieerig Computatio Fidig Roots of No-Liear Equatios March 14, 1945 World War II The R.A.F. first operatioal use of the Grad Slam bomb, Bielefeld, Germay. Cotets 2 Root basics Excel solver Newto-Raphso

More information

Load balanced Parallel Prime Number Generator with Sieve of Eratosthenes on Cluster Computers *

Load balanced Parallel Prime Number Generator with Sieve of Eratosthenes on Cluster Computers * Load balaced Parallel Prime umber Geerator with Sieve of Eratosthees o luster omputers * Soowook Hwag*, Kyusik hug**, ad Dogseug Kim* *Departmet of Electrical Egieerig Korea Uiversity Seoul, -, Rep. of

More information