UNIT 1 RECURRENCE RELATIONS

Size: px
Start display at page:

Download "UNIT 1 RECURRENCE RELATIONS"

Transcription

1 UNIT RECURRENCE RELATIONS Structure Page No.. Itroductio 7. Objectives 7. Three Recurret Problems 8.3 More Recurreces.4 Defiitios 4.5 Divide ad Coquer 7.6 Summary 9.7 Solutios/Aswers. INTRODUCTION I the previous bloc, you have leart to solve various types of combiatorial problems usig a varied set of tools. However, there are may problems that have to do with coutig which caot be tacled oly with the techiques we have preseted so far. To give you oe such example, loo at the problem of coutig the umber of biary strigs of legth that do ot cotai two cosecutive eros. If we deote the umber of such biary strigs by a, the a = ad a = 3. Also, we ca show that a = a a for. This is a example of a recurrece relatio. This relates the value of a, a - ad a -. We will show how to fid a explicit expressio for a usig this relatio i uits ad 3. I this uit, we will discuss how to formulate such recurrece relatios for solvig combiatioal problems. I Sec.., we will itroduce you to recurrece relatios through three famous examples, the Fiboacci recurrece, Towers of Haoi ad the umber of ways of parethesisig a expressio. I Sec..3, we will discuss some more examples to familiarise you with the process of formulatig recurreces. I Sec..4, we will formally defie a recurrece relatio ad explai some termiology related to recurreces lie order ad degree of a recurrece relatio. I the Sec..5, we will see how the Divide ad Coquer techiques used i the desig of algorithms give rise to recurreces i a atural way. Here, we will discuss recurreces associated with algorithms for fidig the maximum ad miimum elemets of a list, fast multiplicatio of itegers etc.. OBJECTIVES After goig through this uit, you should be able to defie a recurrece relatio; give examples of recurrece relatios; set up recurrece relatios; write recurreces for divide ad coquer algorithms. 7

2 Recurreces Fiboacci (7 5). THREE RECURRENT PROBLEMS Let us begi by explorig three sample problems that will give you a idea of what is to follow. The first two of these problems have bee ivestigated repeatedly. All the three problems have a solutio based o the idea of recurreces. This meas that the solutio to each problem depeds o the solutio to smaller istaces of the same problem. Example: (Rabbits ad the Fiboacci umbers): Have you heard of the problem of breedig rabbits? This was origially posed by Leoardo di Pisa, also ow as Fiboacci, i i his boo Liber abaci. The problem is the followig: Oe pair of rabbits, oe male ad oe female, are left o a islad. These rabbits begi breedig at the ed of two moths ad produce a pair of rabbits of opposite sex at the ed of each moth thereafter. Let f deote the umber of pairs of rabbits after moths. The f =. Note that the rabbits start breedig oly after two moths ad the youg oes will be produced oe moth afterwards. So, youg oes are produced oly at the ed of third moth. Therefore the umber of pairs of rabbits is still at the ed of the secod moth i.e f =. At the ed of the third moth, the pair would have produced oe more pair. See Table for details. To fid the umber of pairs after moths, we must add the umber of pairs after moths to the umber of pairs bor i the th moth. But the ewbors come from pairs at least two moths old, i.e. from the pairs that already existed after moths; there are f - of these. Therefore the sequece {f } meets the coditio f = f - f - if 3, ad the f are called Fiboacci umbers. Table : Number of Rabbits o the Islad Moths Reproducig pairs (at least two moths old) Youg Pairs (ot more tha two moths old.) 6 * * * So, have we solved the problem? Not quite; but it uiquely defies the sequece we see, describig its members i terms of some previous members. We ca also defie f as a fuctio of, as i the followig exercise. 5 5 E) Usig iductio, verify that 5 f =,. We will come bac to the Fiboacci sequece later. Now let us cosider aother importat recurret problem. 8

3 Example : (The Tower of Haoi): This problem was iveted by the Frech mathematicia Edouard Lucas i 883. We are give a tower of eight discs, iitially staced i decreasig sie o oe of three pegs. Recurrece Relatios Fig. : Iitial positio for the towers of Haoi problem. The objective is to trasfer the etire tower to oe of three pegs, movig oly oe disc at a time without ever movig a larger disc oto a smaller oe. Lucas furished this toy with a leged about a much larger Tower of Brahma, which supposedly had 64 discs of pure gold restig o three diamod eedles. At the begiig of time, he said, God placed these golde diamod eedles, God placed these golde discs o the first eedle ad said that a group of priests should trasfer them to a third, accordig to the rules above. The Tower will crumble ad the world will come to a ed oce the tas is fiished. Let us geeralise the problem ad see what happes if we have discs istead. Let us say that T is the miimum umber of moves that will trasfer diss from oe peg to aother uder the rules. Clearly, T =, ad T = 3 (see Fig.3). A little bit of experimetatio o three diss leads us to the geeral strategy: We first trasfer the smallest diss to B (requirig T- moves), the move the largest (requirig oe move; remember, it must move!) to C. A is ow empty ad ca be used to trasfer the discs o peg B to C. Thus, we ca trasfer discs 3a) Trasfer disc to peg B 3b) Trasfer disc to peg C 9

4 Recurreces 3c) Trasfer disc to peg C. Fig. 3 : The moves ivolved i trasferrig discs. (for ) i at most T - moves. So, T T -, if. Why have we used istead of = here? Our costructio proves oly that T - moves are eough but ca we trasfer the diss with lesser umber of moves? The aswer is No. At some poit, we must move the largest disc. Whe we do, the smallest must be o a sigle peg (why?), ad it has tae at least T - moves to put them there. After movig the largest disc for the last time, we must trasfer the smallest discs (which must agai be o a sigle peg) bac oto the largest; this too requires T - moves. Hece, T T - if. Both the iequalities, T T - ad T T - ca be true oly whe T = T -. * * * As with the first example, we shall postpoe solvig the recurrece relatio just obtaied to Uit 3. Icidetally, oce you have doe the followig exercise, you will ote that the priests will require a miimum of 64 = moves to trasfer the golde diss. Eve at the rate of oe move per secod, it will tae them more tha 5 years to solve the pule, so the doomsday is far away! Try the ext exercise which gives a explicit expressio for T. E) Usig iductio, show that T =,. Now let us cosider the third problem we had i mid. This is the umber of ways to parethesise a expressio. Example 3: Let us derive the recurrece relatio for the umber of ways to parethesise the expressio x x x so that oly two terms will be added at a time. For example, the expressio ((x x ) x 3 ) is fully parethesised, but (x x ) x 3 is ot. Suppose the umber of ways of parethesisig the expressio x x x is a. If we split the expressio ito x x x ad x, x x x ca be parethesised i a- ways ad x ca be parethesised i a ways. So, i this case, we ca parethesise the expressio i a - a ways. Similarly, if we split up the expressio ito x x x ad x x, we ca parethesise the expressio x x x i a - ways ad the expressio x x i a ways. The total umber of ways i this case is a - a ways. I geeral, if we split up the expressio ito two sub expressios of sie ad, we ca parethesise the expressio i a-a ways. We ca get the total umber of ways of parethesisig the expressio by addig the differet ways of parethesisig the expressio correspodig to differet ways of splittig the expressio. This is precisely a a a a a a aa. Therefore, the recurrece relatio satisfied by a is

5 a = a a a a a a aa for with a =. Recurrece Relatios Usig the fact that a =, we ca exted this to a =, a =, a = a a a a a a a a a ( ). * * * The umbers a, a, a, are called Catala umbers. Catala umbers arise i several other cotexts. We will state two other cotexts without proofs. Example 4: Suppose two cadidates A ad B poll the same umber of votes, each, i a electio. The coutig of votes is usually doe i some arbitrary order ad therefore, durig the coutig process A may lead for some period ad B may lead for some period. The umber of ways of coutig the votes such that A ever trails B is the th catala umber. We ca represet a vote for A by ad a vote for B by. The, the th catala umber is the umber of sequeces of pluses ad miuses such that there are at least as may pluses as there are miuses at ay stage of the sequece. Let us call such a sequece a admissible sequece. Let us tae a special case where 8 votes are cast, 4 for A ad 4 for B. Oe votig sequece where A ever trails is (,,,,,,, ). If we drop the last three terms, we get the sequece (,,,,, ). Here, there are 3 pluses ad 3 miuses i.e. there are at least as may pluses as there are miuses. If we drop the last term, we get (,,,,,, ). Here, there are 4 pluses ad 3 miuses, i.e. there are more pluses tha miuses. *** Example 5: You would have come across the data structure called Stac i MCS-. Recall that, a stac is a list which ca be chaged by isertios or deletios at the top of the list. A isertio is called a push ad a deletio is called a pop. A sequece of pushes ad pops of legth is called admissible if there are pushes ad pops ad at each stage of the sequece there are at least as may pushes as pops. Suppose we have the strig 3 of the set N = {,,3,, } ad a admissible sequece of pushes ad pops of legth. Each push i the sequece trasfers the last elemet i the iput strig to the stac ad every pop trasfers the elemet o the top of the stac to the begiig of the output strig. After pushes ad pops have bee performed, the output strig is a permutatio of N called a stac permutatio. The umber of stac permutatios of 3 is the th Catala umber. Agai, we ca represet a pop by a ad a push by a. If you pause ad thi for a miute, you ca covice yourself that every admissible sequece of pops ad pushes correspods to a admissible sequece of pluses ad miuses. Let us loo at a example. Suppose = 4 ad we have the followig admissible sequece of pops ad pushes: (,,,,,,,, ). Let us fid the stac permutatio correspodig to this. See Table. Table : Fidig the slac permutatio correspodig to the Admissible sequece (,,,,,,,, ) Sequece Iput Strig Stac Output Strig (Push 4) 3 [4] Empty (Pop 4) 3 [] 4 (Push 3) [3] 4 (Push ) [3] 4 (Pop ) [3] 4 (Pop 3) [] 34 (Push ) Empty [] 34 (Pop ) Empty [] 34 So, the permutatio obtaied is 34. This is a example of a stac permutatio of sie 4. * * * Try the followig exercises ow to chec if you have uderstood our discussio so far.

6 Recurreces E3) Which of the followig sequeces are admissible? i) (,,,,,,, ) ii) (,,,,,,, ) iii) (,,,,,,, ) E4) Is the statemet A admissible sequece has to start with a plus ad ed with a mius true? Explai your aswer. E5) Cosider the problem discussed i the itroductio. Let a be the umber of biary sequeces of legth that do ot cotai cosecutive eros. Show that a =a - a - for 3. You will have oticed that i each of the three problems, we have bee able to express the th term of a sequece i terms of oe or more previous terms ad a fuctio of. This gives you a method to compute the terms of the sequece accurately, give eough time. At times, if the relatio betwee the terms is i a reasoably ice form, we ca eve solve the recurrece, that is, express the th term as a fuctio of. You will lear how to solve these three recurreces i the ext uits. Let us ow cosider some more recurret problems..3 MORE RECURRENCES You have bee exposed to some famous recurret problems i the previous sectio. I this sectio, we shall tae aother loo at settig up recurrece relatios for combiatioal problems of the id you would have ecoutered i MCS-3. You will fid that i tryig to determie recurrece, we are really attemptig to describe the coutig iductively. I most cases, you will see that the recurrece relatio leads to a alterate method of solutio, although the methods themselves will be dealt with i Uit 3. Example 6: Let C be the umber of comparisos eeded to sort a list of itegers. Let us fid a recurrece relatio for C. We first fid the miimum of the elemets. This will be the first elemet of the list. We compare the first two elemets ad fid the miimum amog the two. We compare this miimum with the third elemet, ad so o. For fidig the miimum of elemets we have to mae comparisos. For example, if we wat to fid the miimum of the list 3,, 4,, 5, we will have to mae 4 comparisos as show i Fig.4. Fig.4 : Comparisos for fidig the miimum of 3,,4,,5 After maig the miimum elemet the first elemet of the list we ca sort the remaiig elemets with C comparisos ad apped it after first elemet. So, C comparisos are required to sort a list of elemets.

7 (i.e.) C = C * * * Try the followig exercise which ass you to prove a expressio C. Recurrece Relatios E6) I Example 6, usig the recurrece relatio for C, show that C = ( ),. Example 7: You may recall that the set of all subsets of ay o-empty set, S, is called its power set, ad deoted by p(s). Let us determie a recurrece relatio satisfied by s = p (S), where S =. Let us tae S = {,,, }. Now, ay subset, A, of S either cotais the umber or does ot cotai the umber. Let us cosider these two mutually exclusive cases separately ad cout the umber of such subsets, A. If ε A, the A = A {}, where A is a subset of {,,., }, there are s - such subsets A. So, the umber of subsets A that cotai is the same as the umber of subsets of {,,, }, which is s. O the other had if A, the, i fact, A is a subset of {,,, } these, we see that s = s s = s,, with s =. * * * We as you to prove that s = i the ext exercise., ad there are s of these too. Combiig E7) I Example 5, usig the recurrece relatio for s, show that s =,. Example 8: Recall that a bijectio is a oe-oe, oto mappig of a set oto itself. It is quite easy to determie directly the umber of bijectios of a -set (a set with elemets). We will, however, loo at a recurrece relatio satisfied by the umber of bijectios, b, of ay -set, say {,,.,}. To begi with, if f is ay such bijectio, f() could be ay oe of the elemets of the set {,,, } ; but ow we must map {,,, }bijectively to {,,..., } \ { f() } ; this ca be doe i b ways. f() ca be chose i ways. I all the, b = b,, with b =. * * * Agai, we as you to prove a expressio for b. E8) I Example 8 usig the recurrece relatio for b, show that b =!,. We ed this sectio by looig agai at the problem of deragemets, discussed i MCS-3. Example 9: You may recall that the problem is to determie the umber of deragemets of objects, d, ad that we had employed the method of Iclusio- Exclusio to solve it. Let us fid a recurrece relatio for d. Recall that d couts the umber of permutatios of objects that leave o object fixed. Ay such permutatio is called a deragemet. Let us begi by labelig the objects serially:,,,. I ay such deragemet of objects, gets set to some i, where i. Two cases arise: For the same deragemet, either i gets set bac to or it does ot. I the first case, we ca leave out ad i from the origial set ad obtai a deragemet of objects; there are d - such possibilities. Suppose i is ot set bac to. The, we ca get a deragemet of {, 3,, } as follows. Some umber must be mapped bac to,3,, as follows:, suppose j is mapped to. We ca defie a deragemet of { } ) Map j to i ) Every other elemet is mapped accordig to the origial deragemet See page 56, Bloc, of MCS- 3 3

8 Recurreces Thus there are d - such possibilities to obtai a deragemet of objects. Therefore, assumig gets set to i, there is a total of d - d - possibilities. Observig that i could have bee ay umber betwee ad, we coclude that d = ( ) (d - d - ) for 3. To complete the recurrece relatio, we ote that d = ad d =. You will have oticed that to compute d oe eeds to ow the values of the two precedig terms. Ca we get to compute d o the basis of the value of oly oe precedig term, d -? To explore this, let us write the recurrece i the form d d - = [d - ( ) d - ]. We ow observe that the expressio o the right had side withi the bracets is got from the expressio o the left had side by merely replacig by. If we write D = d d -, we have the simplified expressio D = D -. But the D - = D -, ad so D = D -. Cotiuig this procedure, we arrive at D = ( ) - D = ( ) [d d ] = ( ). Therefore, we have d = d - ( ) if, with d =. * * * I the ext exercise, we as you to prove the expressio for d we derived i Bloc, Uit, but usig the recurrece for d this time. E9) Usig iductio ad either of the two recurrece relatios for d, show that i ( ) d =!,. i! i = We ed this sectio with a few problems i which you are required to set up the recurrece equatios. E) Set up a recurrece relatio for the determiat of the matrix with alog the mai diagoal ad with o either side of the mai diagoal i each row ad ero elsewhere. For example, the 3 3 determiet is E) Set up a recurrece relatio for the umber of digit sequeces o itegers {,,, 3} havig a eve umber of s. E) Show that the umber of r-permutatios of distict objects, P(,r), satisfies the recurrece relatio P(, r) = P (, r) rp (, r ),, r. E3) Let S r deote the Stirlig umbers of the secod id, that is, the umber of ways to distribute r distict objects ito odistict boxes with o box left empty. Show that S r satisfies the recurrece relatio S = S S, < < r. r r r. I the ext sectio, we give all relevat defiitios ad itroduce the otatio for studyig recurrece relatios..4 DEFINITIONS 4 We hope you have got a fairly good idea of what a recurrece relatio is, as well as how to set it up by ow. It is time to formalise the procedure ad set up a more

9 rigorous mathematical pedestal for it. Let us ow defie a recurrece relatio formally. Recurrece Relatios Defiitio: Let {a : } be a sequece of real or complex umbers. A recurrece relatio (or a recurrece equatio) is a expressio of the form a = F (a -, a -,., ) where F is a fuctio of some of the variables a -, a -,, a,. Note that all the a i s eed ot occur i the expressio. I other words, it allows us to compute the th term of a sequece from oe or more of the precedig terms. The symbol F merely deotes a (ay) fuctio ad the variables are (some or all of) the precedig terms i the sequece as also. For our purposes, we shall oly deal with such fuctios F which are polyomials ad deped o oly fiitely may variables, a = F (a -, a -,, a -, ) Defiitio: The order of the recurrece relatio defied by a = F (a -, a -,, a -, ) is, where a depeds o oe or more of the previous terms ad is the smallest such iteger. We do ot defie a order for recurrece relatios of the form a = F (a -, a -,, a o, ) that deped o each of its previous terms. Therefore, if we ca compute the th term of a sequece from the precedig terms, but ot from the precedig terms, we defie the order to be. Defiitio: The degree of the recurrece relatio is the degree of F treated as a polyomial i its variables excludig. If F is ot a polyomial i its variables, o degree is assiged to the recurrece relatio. A recurrece relatio of degree oe is also called liear, oe of degree two quardratic, ad so o, just lie we have i the case of polyomials. After all, the otio of degree is tied up with the degree of the defiig polyomial F. Defiitio: A recurrece relatio is called homogeeous if it cotais o term that depeds oly o the variable. A recurrece relatio that is ot homogeeous is said to be o-homogeeous or ihomogeeous. Thus, for a recurrece to be called homogeeous, every term defiig the recurrece must cotai at least oe of the precedig terms of the sequece. Usually, the term homogeeous is used for liear recurreces regardless of its order. Examples: ) a = 3a - is ohomogeeous of order ad degree. ) a = a - is ohomogeeous of order ad degree. 3) a = a a is homogeeous of order, but has o degree. 4) a = a - a - a is homogeeous, has o order, but has degree. 5) a = a a - a -3 a -4 is homogeeous of order 4 ad degree 3. 6) a = si a - cos a - si a -3 e is ohomogeeous, has o order ad o degree. 7) a = f ()a - f ()a - f - () a - g() represets the geeral form of a liear th order recurrece relatio (f - () ). It is homogeeous if g() = for each, ad ohomogeeous otherwise. 5

10 Recurreces 8) a = a a - a a - a - a ( ) with a =, a = is a oliear recurrece relatio. 9) a, = a -, a -, - is a recurrece relatio i two variables ad. Taig a, = C(,), the give relatio is othig but Pascal s idetity with iitial coditios a, = C(,) = a, = C(, ) = for all ad a, =, ) a, = a, - a 3, - a 4,, with iitial coditios a, = a 3, = a 4, = ad a, = otherwise, is a recurrece relatio i two variables (This is the recurrece relatio for the ways to distribute idetical balls ito distict boxes with betwee two ad four balls i each box). ) a = a / with a = ( a power of ) is a oliear recurrece relatio. Chec your uderstadig of the cocepts of order, degree ad homogeeity with respect to recurrece relatios by tryig the followig exercises. E4) Fid the order ad degree of each of the followig recurreces. Also, state whether they are homogeeous or ohomogeeous. a) a = a - a - b) L = L - c) d = d - ( ) d) a = a a a a a ( ). o o You must have observed while looig at the various examples above that the recurrece relatio aloe will ot defie for you the terms of the sequece. To be able to do this, oe eeds to ow where to begi the sequece. For example, the th Fiboacci umber ad the umber of biary sequeces of legth that do ot cotai cosecutive eros satisfy the same recurrece relatio. If a is defied i terms of a - aloe, decidig the value for a (or, a, or wherever you wish to begi the sequece) uiquely describes the sequece for you. More geerally, i case of a th order recurrece, oe eeds to ow the first terms, typically a,, a - of the sequece i order to uiquely defie the sequece. A well-defied liear recurrece relatio of degree cosists of a recurrece part ad iitial coditios for cosecutive values. Defiitio: We say that a th order recurrece relatio is a recurrece relatio with iitial coditios provided oe or more of the values a, a,, a - are ow. Defiitio: A fuctio f() is said to be a geeral solutio to the recurrece relatio if it satisfies the recurrece equatio. A fuctio g() is said to be the particular solutio to a recurrece relatio if it satisfies the recurrece equatio, together with the iitial coditios. Please ote that there are ifiitely may geeral solutios to ay recurrece relatio without iitial coditio(s), oe for each set of values for the iitial terms, but oly oe solutio oce the first iitial terms are fixed for recurrece relatios of order. You have bee verifyig that give fuctios are ideed solutios to the recurreces of the previous two sectios. We give a few more examples of a simpler ature. The solutio of recurrece relatios will be discussed i uit 3. Examples: ) The geeral solutio to a = a - is a = c, where c is ay costat, but if i additio a =, the the solutio is a =,. ) The geeral solutio to a = a - is a = c, where c is ay costat; if a =, the the solutio is a =,. 3) The geeral solutio to a = a - is a = c, where c is ay costat; if a =, the the solutio is a =,. 6 4) The geeral solutio to a = a - a - is

11 5 5 5) a = c c, where c, c are ay costats. 6) If a =, a = 3, the the particular solutio is 5 5 7) a =,. 3 8) The particular solutio to a a = with a =, is 9) a = ( )( ) 6 * * * Recurrece Relatios I the cocludig sectio, we discuss some commo types of recurrece relatios that result from divide ad coquer algorithms..5 DIVIDE AND CONQUER RELATIONS Ofte, to solve a problem, we ca partitio the problem ito smaller problems, fid solutios to the smaller problems ad the combie the solutios to fid a solutio for the whole. We ca repeatedly partitio the problem till we reach a stage where we ca solve the problem quite easily. This approach is called the divide-ad-coquer approach. Let us start with a example. Throughout this sectio we will assume that =. Example : Cosider the problem of fidig the maximum ad miimum of a list of umbers. Here let us assume that = for some to mae thigs simpler for us. Let a be the umber of comparisos required for fidig the maximum ad miimum of a list of umbers. We ca partitio the list ito two lists of sie each. The maximum ad miimum of each of the list ca be foud usig a comparisos. We ca the compare miimum (resp. maximum) of the lists to get the miimum (resp. maximum) of the list, i.e., we will eed two more comparisos. So, a = a for. a =. We leave it as a exercise for you to chec that a = 3, whe is a power of. E5) Chec that a = 3 is a solutio to the recurrece a = a where is a power of ad a =. Defiitio: We call a recurrece a divide-ad-coquer recurrece if it has the form a = ba d() a where a >, b > are itegers ad d() is a fuctio of. Such a relatio results whe we split a problem of sie ito b sub problems of sie. After solvig each of the sub problems we may eed d() steps to get the solutio a to the origial problem of sie. I Example, we splitted a problem of sie ito 7

12 Recurreces sub problems of sie each ad we eeded more steps to get the aswer to the origial problem. So, a = b = ad d() = i this example. Example : I a teis touramet, each etrat plays a match i the first roud. Next, all wiers from the first roud play a secod-roud match. Wiers cotiue to move o to the ext roud, util fially oly oe player is left as the touramet wier. Assumig that touramets always ivolve = players, for some, fid the recurrece relatio for the umber rouds i a touramets of players. Fig.5: A touramet ivolvig 8 players Solutio: The touramet is subdivided ito sub touramets of / players each. Here the first roud of both the touramets are held together so that they are cosidered as a sigle first roud. Similarly, all the other rouds are held together. So, after a / rouds, oe player will be left i both the sub touramets. The wier of the match betwee the two is the wier of the touramet. So, a = a /. See Fig.5 for a touramet ivolvig 8 players. * * * Let us ow discuss some more problems where divide ad coquer approach ca be used. 8 Example : (Biary search) Suppose we have a sorted list of = umbers ad we wat to chec whether a particular umber is i the list or ot. If we compare the umber with all the elemets of the list we eed comparisos i the worst case. However, we will describe a better algorithm called the biary search algorithm which uses the divide- ad-coquer paradigm. Let us loo at a particular example. Suppose we wat to chec whether is i the list,,3,5,6,7,,3. We split up the list ito two parts.,,3,5 ad 6,7,,3. We compare with the last elemet of the first list which is 5. We have 5 < ad all the elemets i the first list are less tha 5. So, we ca discard the first list. The secod list is agai split ito two parts, 6,7 ad,3. Sice 7 <, we discard the first part. We split,3 ito two lists of oe elemet each. The first of these two lists,, cotais. Let a deote the umber of comparisos required while searchig for a elemet i a sorted list of sie. The a =. I geeral, we ca split up the list ito two equal parts of / elemets each. We ca compare our elemet with the last elemet, which is the largest elemet, of the first list. This will tell us whether we have to search i the first list or i the secod list. I either case we have to search i a list of sie / oly. So, a =a /. * * * Example 3: (Merge sort) Suppose we wat to sort a list of = elemets i ascedig order. We ca divide the list ito parts of sie / each, sort them ad merge

13 them ito a sorted list. Suppose a is the umber of compariso required to sort a list of elemets the, the two lists ca be sorted usig a / comparisos each. Let us call the lists L ad L. We will merge them ito a ew sorted list L. We compare the first (smallest) elemets of the list, add the smallest elemet of the two to the ew list L ad remove the smallest elemet from the list from which we selected it. We repeat this till oe of the lists, say L is empty. The we apped L to the list L to get a sorted list. See Table 4, where we show how to merge two sorted lists,,5,6 ad 3,4. Recurrece Relatios Step L L L Actio tae,, 5, 6 3, 4 -- <3. Remove from L ad add it to L., 5, 6 3, 4 <3. Remove from L ad add it to L. 3 5, 6 3, 4, 5>3. Remove 3 from L ad add it to L. 4 5, 6 4,, 3 5>4 Remove 4 from L ad add it to L. 5 5, 6 --,, 3, 4 L is empty. No more comparisos required. Add the remaiig elemets of L to L to get the sorted list,,3,4,5,6 Here L ad L are ot of the same sie. We eeded 4=5 comparisos to sort lists of sies 4 ad. I geeral, to merge two sorted lists of sie m ad uder this method at most m comparisos are required. So, to merge the two lists of sie / each, at most comparisos are required. So, a =a /. E6) Fidig the th power of a iteger i, by successive multiplicatios by i requires multiplicatios. Assumig =, describe a divide ad coquer algorithm such that if a is the umber of multiplicatios to fid the th power, the a = a /. Is the algorithm desirable give that the solutio is give by a = log ()? E7) Fidig the product of a list of itegers by successive multiplicatio requires multiplicatios. Assumig =, describe a divide ad coquer algorithm for which the umber of multiplicatios a satisfies the recurrece relatio a = a / E8) To multiply two -digit umbers, oe must do ormally digit-times-digit multiplicatios. Use a divide ad coquer algorithm to do better whe is a power of. With this we have come to the ed of this uit. Next two uits will deal with the methods of solvig recurrece relatios. Now let us tae a quic loo at what we have discussed i this uit..6 SUMMARY I this Uit recurrece relatios we: ) discussed several examples of recurrece relatios, draw from well-ow problems ad from routie exercises i combiatorics. ) discussed how to set up recurrece relatios after havig read this uit. 3) defied the homogeeous, o-homogeeous recurrece relatios. 4) defied the order ad degree of a recurrece relatio. 9

14 Recurreces 5) discussed settig up of recurrece relatios with the help of divide ad coquer paradigm..7 SOLUTIONS/ANSWERS 5 5 E) It is easy to chec that f = = f. With α =, β=, we observe that αβ are solutios to the equatio x x =. α = α, β = β. If 3, 5 f f = α β α β ( - - ) ( ) ( ) as desired. ( ) ( ) =α α β β =α α β β =α β = 5 f, E) Observe that T =. If, T - = ( - ) = = T, verifyig the formula. E3) ) ad ) are admissible. If we drop the last three terms from 3), we get (,,,, ) which has two pluses ad three miuses. So, 3) is ot admissible. E4) Yes, this is true. If a admissible sequece starts with a, the sequece got by removig all the terms except the first oe has more miuses ( mius) tha pluses ( Plus). Suppose a admissible sequece eds i a plus. The sequece we get by removig a plus has more pluses tha miuses. If we put bac the plus, the sequece will still have more pluses tha miuses. But, a admissible sequece must have equal umber of pluses ad miuses. E5) Cosider ay strig of legth. The last bit of the sequece is either or. If the last bit is, the previous bit must be. So, it ca be obtaied by addig to a strig of legth. (Note that cosecutive s are allowed!) If the last bit is, this ca be obtaied by addig to a strig of legth. a = a a Note that, a satisfies the same recurrece satisfied by the Fiboacci sequece. We have f =, f =, but a =, a =3. E6) It is easy to see that C =. If, C - = ( ) ( ) = ( ) = C, as desired. E7) Observe that s =. If, s - =. - = = s, verifyig the formula. E8) We ote that b =. If, b - =. ( )!! = b, as required. E9) We chec that d =, d =. To verify the first order recurrece relatio, ote that if, i ( ) d ( ) = ( )! ( ) i i! = i ( ) ( ) =! ( ) i= i!!

15 i ( ) =! = d i= i! as desired. I case of the secod order recurrece relatio, if, i i ( ) ( ) ( ) (d d ) = ( ) ( )! ( )! i= i! i= i! as desired. i i i ( ) ( ) ( ) i i ( ) ( ) ( ) i ( ) =.( )! ( )! ( )! i! i! i! i= i= i= =! ( )! =! ( ) i! ()! i! = i= i= i= i! = d, Recurrece Relatios E) Let Δ deote the required determiat. Expadig about the first row, we get Δ - mius the determiat which whe expaded about its first row yields Δ -. The correspodig recurrece relatio is Δ = Δ - Δ -, 3, with Δ =, Δ =. E) Let a deote the umber of -digit sequeces cotaiig a eve umber of s. The there are a - ( )-digit sequeces that have a eve umber of s ad 4 - a - ( )-digit sequeces that have a odd umber of s. To each of the a - sequeces that have a eve umber of s, the digit, or 3 ca be appeded to yield sequeces of legth that cotai a eve umber of s. To each of the 4 - a - sequeces that have a odd umber of s, the digit must be appeded to yield sequeces of legth that cotai a eve umber of s. Therefore, for, a = 3a a - = a - 4 -, with a = 3. E) Of the distict objects, pic ay oe object ad call it special. The, the umber of r-permutatios i which this special object does ot appear is P(, r) because this is the umber of r-permutatios of the remaiig ( ) objects. O the other had, if the special object does appear, the umber of r-permutatios is rp(, r ) because the special object could be i ay oe of r positios betwee objects or at either ed, ad we have the to determie the umber of ( r )-permutatios of objects. Combiig the two, we get the required recurrece. E3) This is somewhat similar to the previous oe; choose a special object first. The box cotaiig this object either cotais o other object or cotais at least oe more. I the first case, we eed to distribute r distict objects ito odistict boxes, with o empty box; the umber of ways i which to do this is S r. Otherwise, the special object may be placed ito ay oe of the (odistict) boxes (there are choices), ad we still eed to distribute r objects ito odistict boxes, with o empty box; there are S r such choices for each choice of the box the special object is placed i. Combiig the two cases gives the recurrece relatio. E4) a) order, degree b) order, degree c) order, degree d) order ot defied. Degree is.

16 Recurreces 3 E5) Whe =, =. Let us suppose =. Let us apply iductio o. Suppose it is true for, say m =, the a = a m m m = 4 3m = = 4 = 3 m Thus it is true for. E6) Divide by, fid i, ad square it. Thus a = a. The algorithm is desirable sice log () grows more slowly tha. E7) Divide by. Fid the product of itegers ad the product of last itegers. Multiply two products obtaied. Thus a = a. E8) Let be a power of. Let the two -digit umbers b A ad B. We split each of these umbers ito two digit parts: ad A = A A B = B B (lie 35 = 35) The A.B = A BB AB B A B AB AB We eed oly to mae three - digit multiplicatios, A.B, A.B ad (A A ). (B B ) to determie A. B sice A. B B. A = (A A ). (B B ) A. B A. BB Actually (A A ) or (B B ) may be -digit umbers but this slight variatio does ot effect the geeral magitude of our solutio (lie 95 = 95). If a represets the umber of digit-times multiplicatios eeded to multiply two -digit umbers by the above procedure, this gives the recurrece relatio a = 3 a log 3 =.6 a is proportioal to a substatial improvemet over.

17 UNIT GENERATING FUNCTIONS Structure Page Nos.. Itroductio 3. Objectives 3. Geeratig Fuctios 4.3 Expoetial Geeratig Fuctio 3.4 Applicatios Combiatorial Idetities.4. Liear Equatios.4.3 Partitios.4.4 Recurrece Relatios.5 Summary 45.6 Solutios/Aswers 45. INTRODUCTION I your earlier Mathematics courses, you may come across power series expasios of fuctios lie e x, si x etc. There, we have to worry about covergece questios, i.e for which values of x does the expasio represet the fuctio. Here, we will discuss power series expasios from a differet poit of view. We will ot be iterested i covergece questios because we will ever substitute umerical values for x; rather we will be iterested i the combiatorial properties of the power series. Sequeces of umbers that have combiatorial sigificace appear as the coefficiets of power series. We call the power series where coefficiets are the terms of a sequece as the geeratig fuctio for the sequece. For example, we will see later i this Uit that are the Fiboacci umbers. Thus, the coefficiets of the power series of ( ) ( ) is the geeratig fuctio for the Fiboacci umbers. I sec.., we shall explai the cocept ad some elemetary uses of geeratig fuctios. I Sec..3, we shall itroduce you to a particular type of geeratig fuctios that are used to solve arragemet problems i combiatorics. I sec..4, we shall explore the power of the geeratig fuctios as a tool whe, for example, it is used to derive some combiatorial idetities, solve some combiatorial problems ivolvig geeral iteger equatios, fid the umber of partitios ad solve certai recurrece relatios.. OBJECTIVES After goig through this uit, you should be able to defie ad costruct geeratig fuctios for sequeces arisig i various types of combiatorial problems; use geeratig fuctios to fid the umber of iteger solutios to liear equatios. fid the geeratig fuctio associated with a sequece i closed form i some simple cases fid the expoetial geeratig fuctio associated with a sequece i closed form i some simple cases; solve recurrece relatios usig geeratig fuctios; ad use geeratig fuctios to prove idetities ivolvig combiatorial coefficiets. 3

18 Recurreces. GENERATING FUNCTIONS Ofte, we ca relate the solutios of a combiatorial problem to the coefficiets of a power series. I the ext example we will see how to relate the umber of iteger solutios to certai liear equatios to the coefficiets of a power series. Example : Determie the umber of iteger solutios to liear equatio X = 3, with X ad X. X Solutio: By explicit eumeratio, the possible values are give below. X X Sum 3 Thus, there are two ways to obtai a sum of (also ) ad oe way to obtai the sum 3. Now cosider the followig product of polyomials: ( )( ), Where the expoets of symbol i the first factor correspoded to the possible values of X ad i the secod factor to the possible values of X. O expadig this product, we get ( )( ) = ( ) = 3. Addig the expoets of the symbol after multiplicatio correspods to cosiderig the sum of the values of X ad X. We ote that the coefficiet of r, r 3, i this expressio gives the umber of iteger solutios to X X = r, with X ad X. I particular, because the coefficiet of 3 i the above expressio is, ad there is oly oe pair of values vi. (,), which satisfy the give liear equatio. * * * Suppose we ited to fid o-egative iteger solutios to the liear equatio X X X3 =, with X 4, X >, ad X3 The, by argumets give i the example above, we tae the product of the followig three polyomials. 3 4 ( )( ) ( L). 4 I the above product, both secod ad third factors are ifiite because there is o upper boud o X ad X. Also, secod factor does ot cotai the costat term owig to the fact that X >. The, as before, the coefficiet of i the above expressio will give us a solutio to the liear equatio give above.

19 For fidig the coefficiets of a power series, we ofte use the followig results. Result : (Biomial Theorem) Geeratig Fuctios Let > the a) ( ) = r C(,r) r= b) ( ) = r= r r C( r,r)( ) c) r ( ) = ( L) = C( r,r). r= Result : = L,. Next, we illustrate the techique of idetifyig the power series associated with a combiatorial problem with the help of followig example. Example : Fid a power series associated with the problem where we have to fid the umber of ways to select a doe pieces of fruit from 5 Apples, Baaas ad 5 Cocouts. Solutio: To begi with, let us use the letters A, B ad C for Apples, Baaas ad Cocouts, respectively. So, if we select Apples, l Baaas ad m Cocouts, the we must have l m =, with the restrictio that 5, l ad m 5. Let us see what we could do to set up the problem usig the symbols A, B ad C. Here we may deote Apples by A, l Baaas by B l, m Cocouts by C m. The we have piced the correct umber of pieces provided the degree (i.e. the sum l m) of the term A B l C m equals. Thus, to fid the required umber of ways of selectig a doe pieces of fruit, you simply have to fid the umber of terms i the expasio. 5 5 (A A L A ) (B B L B ) (C C L C ) () whose degree equals. This will be the sum of the coefficiets of all the terms A B l C m i () such that l m = i.e. of A B C, A B C, etc. At this poit it is importat to observe that ay selectio of fruits with the give restrictio o the umbers, l ad m correspodes to precisely oe term i this product. For istace, if you pic 3 Apples, 4 Baaas ad 5 Cocouts, the correspodig term i the product () is A 3 B 4 C 5. Coversely, the term AB C 9 represets the choice of Apple, Baaas ad 9 Cocouts. Thus product () whe i j expaded as a A B C gives the required (fiite) power series for the give i, j, ij, problem. * * * Now, sice our real iterest is i the degree of A B l C m (i.e. i the sum l m), we may as well replace each of these symbols i () by a commo symbol, say. The, 5

20 Recurreces as before, we are led to determie the coefficiet of i the followig product of polyomials. 5 5 ( L ) ( L ) ( L ). Now we do t eed to loo ito the possible ways i which A B l ad C m add up to fruits. Next, let us as a similar questio for the problem give i the followig example. Example 3: How ca a power series be associated with the problem i which we have to fid the umber of selectios of fruits if we have Rs.5 with us ad it is give that a Apple costs Rs. 5, a Baaa Rs. ad a Cocout Rs.3 Solutio: Sice here we do t have ay restrictio o the umber of pieces of fruit, the required power series (i terms of moey) is of the form (A A A L)(B B B L )(C C C L), which is the product of three polyomials (ifiite because there is o restrictio o the umber of pieces of fruit). Because a Apple costs Rs.5, so, purchase of Apples would mea that we have to sped Rs.5. Similarly, purchase of l Baaas ad m Cocouts will amout to spedig Rs. ( l 3m). Thus purchase of ( l m) fruits 5 l 3m correspod to the term A B C i the above product of three polyomials. Also because we have Rs.5 oly, we must have 5 l 3m = 5. O the other had, each 5 3m term A B l C (with 5 l 3m = 5) i the above series gives a choice for purchasig Apples l Baaas ad m Cocouts. Thus, i view of give cost of the Apple, Baaa ad Cocout, power of symbols A, B ad C i the first, secod ad third polyomials are multiples of 5, ad 3, respectively. As before, i this expressio we see the umber of terms with degree 5. However, by our discussio followig Example, if we replace each of these symbols by a commo symbol (say) the the required umber is give by the coefficiet of 5 i the expressio ( L )( L)( L). (*) Hece, this product o expasio gives the power series associated with the above problem. I above example, if we impose some restrictios o our selectio of the fruits, the there will be a correspodig chage i the associated power series (*). This is what we wat you to see i the followig exercise. E) Fid the power series associated with the problem give i Example 3, a) whe all our selectios are required to have Apple at least; b) whe each selectio has to have at least oe fruit of each type. You have see above how to associate a power series with a combiatorial problem, such that, the solutio of the problem is give by certai coefficiets of that series. Certai series ca be writte i a fuctioal form which we call as closed form. For example, it follows from Biomial theorem (see Result, a) give above) that ( ) To distiguish them from expoetial geeratig fuctios (which we will defie i the ext sectio), they are sometimes called ordiary geeratig fuctios. 6 is the closed form (or a fuctioal form) of the power series Defiitio: The geeratig fuctio A () (say) for the sequece of real (or complex) umbers, { a,a,...,a,...} is give by the powers series A () = = a = a a... a... = r r

21 Thus, the () th term a of the sequece {a }, is simply the coefficiet of i A (). As said before, the geeratig fuctio thus serves the purpose of idetifyig the differet terms of a sequece by differet powers of the symbol. Geeratig Fuctios Let G () be the geeratig fuctio of the geometric progressio {ar }, i.e. G () = a (ar) (ar ) L The, ( ) G() a = r a (ar) ar = r(g()) which gives, o simplificatio, G () = a/ ( r) Why do t you try a exercise ow? E) Verify that a) The geeratig fuctio for the fiite geometric progressio {a, ar, ar,..., ar }is a ( r ) /( r). b) The geeratig fuctio for the sequece of Biomial coefficiets {C (, ),C (,) a, C (, ) a,...}is ( a). c ) the geeratig fuctio for the sequece of Biomial coefficiets {C (, ),C(,) a,c (, )a,...}is ( a). Note that the geeratig fuctio for a fiite sequece is the geeratig fuctio for a correspodig ifiite sequece which ca be obtaied by settig to ero every term ot previously defied. Thus for a fiite polyomial a a a we write a a a L Now let us see how the techique of associatig a series with a sequece is helpful i solvig a combiatorial problem. We try to uderstad this with the help of followig example. Example 4: Determie the umber of subsets of a set of elemets,. Solutio: Let s deote the umber of subsets that a set of elemets ca have. I the previous uit, you have see that the recurrece relatio satisfied by the sequece {s } is give by s = s if ad s =. (see Example 7, Uit ) Let S () stad for the geeratig fuctio of the sequece {s }. So, we ca write S() = s = = = = = = i.e.s() = S(). s = s (by defiitio of S, ) s = S(), Solvig last equatio for S (), we get = = S () =. ( by Biomial theorem) Fially, comparig the coefficiets of o both sides of above equatios, we get s =,. Thus, the umber of subsets of a set of elemet is,. Two symbolic series aad b are equal iff a = b,. 7

22 Recurreces As you have see i above example, some (algebraic) operatios are eeded at the middle stage of the process while writig the geeral term of a sequece explicitly. These operatios o geeratig fuctios, which we are defiig below, have a crucial role to play i solvig combiatorial problems. Apart from the usual operatios of additio, subtractio, multiplicatio ad divisio of series, we may eed to itegrate or differetiate a power series. It is importat to observe that, while performig last two operatios, our aim is to associate with the ( ad a d) d object ( a ) ( ) d of O 3 (ad O 4, respectively). a ew power series as give i the right had side b = (a ± O (Sumad Differece) a ± b ) O.(Multiplicatio) O O 3 4.(Differetiatio).(Itegratio) ( a ) ( b ) = d d ( a ) = ( ) a ( a ) a = ; a d =. b ; 5 ( ) ( ) = O.(Divisio) a b c ( b )( c ) = a,i.e.,a = bc. = The quotiet of two power series defied i O 5 above is via the product i the usual maer. I fact, there is o really coveiet expressio for the quotiet. Next, let us ow loo at some geeral results which provide coectio betwee the geeratig fuctios of various sequeces, terms of which are related i some maer to each other. These results are particularly useful whe we ow the geeratig fuctios of some of these, ad wat to fid the same for others. a ad { } are two sequeces, the sequece If { } b { } c, where c = a b is called the covolutio of the sequeces. If A() ad B() are the geeratig fuctios of the sequeces { a } ad { b }, respectively, accordig to O, the geeratig fuctio of the covolutio of { a } ad { b } is A()B(). Here is a exercise ivolvig covolutio of sequeces., E3) Prove the Biomial idetity C(m, j)c(, j) = C(m, ), usig Lemma j =. Hece deduce the Biomial idetity C(, j) = C (, ) j = We ext prove aother useful lemma of similar ature. 8 Lemma : Suppose that the sequece {a }, has the geeratig fuctio

23 A (). The, geeratig fuctio B() (say) for the sequece {b }, where b = a a - for,ad b = a,is give by B() = ( )A(). Proof: By defiitio, the geeratig fuctio for the sequece {b } is B() = = = = = b a a [A() a ] A() = ( )A() This completes the proof of the lemma. b b = a = = Try the followig exercise ow. a (usig defiitio of b ) Geeratig Fuctios E4) a) Use Lemma to fid the geeratig fuctio A() (say) for the sequece i arithmetic progressio {a, a d, a d, }. b) Suppose that A() is the geeratig fuctio for the sequece {a },, Show that the geeratig fuctio S() (say) for the sequece {s } of its A() partial sums vi. s = a, ( ) is give by S() =. = c) Use (b) to fid the geeratig fuctio for the sequece {, 3, 6, }. We ext loo at a problem which you might have solved earlier by differet methods. Usig geeratig fuctios, we shall give you alterative methods of solvig them. This is a example ivolvig the sum of -th power of the first atural umbers which we deote by σ i.e σ =... = i,. i= You already ow how a formula for σ ( 3) ca be verified by iductio (see Uit of MCS-3). Let us see how geeratig fuctio techique maes this tas easier. You will see this i operatio for the evaluatio of σ j i the followig example. = j = Example 5: Differetiatig the Biomial fuctio ( ) =, we get j j = ( ) (see O 3 ) j= Multiplyig this by o both sides, we get j= j j = ( ) j= j Repeatig this process of first differetiatig ad the multiplyig by, we get A () = j= j j = ( ) ( ) where we write A () for the geeratig fuctio of the sequece { j The 3, } j. 9

24 Recurreces A() (by E4, b) ( ) σ = j = = j= = = ( )( ) 4 Therefore, is the coefficiet of i the series which ca be obtaied by σ expadig the fuctio ( ) ( ) ) 4 ( ) (. However, because 4 = ( ) 4 ( ) 4 this is the same as looig for the sum of coefficiets of form of the Biomial fuctio ( ) C (, ) = C ( ) we have 4 σ = C (,3) C (,3) = ( ) ( ) Try the followig exercise ow.. ad Thus, i view of Biomial idetity / 6. i the expaded E5) Fid the sum of the first atural umbers usig geeratig fuctios. σ So far, you leart how to idetify geeratig fuctios ad use them to solve some simple combiatorial problems. However, there are several combiatorial problems which are hard to crac by usig these fuctios. This is particularly true of problems that ivolve arragemets (i which order plays a crucial role) ad distributios of distict objects (see Bloc of MCS-3 for more details). I the ext sectio we itroduce you to a slightly differet id of geeratig fuctio which will prove useful for solvig these type of problems..3 EXPONENTIAL GENERATING FUNCTIONS I this sectio, we shall study a modified form of the series we discussed i the last sectio. To uderstad the differece, let us cosider the problem of fidig the umber of three-letter words i.e., a strig of three letters which ca be formed from a two-alphabet set {a, b} (say), with the restrictio that ot all letters i these words are idetical. A ordered pair (x,y) of positive itegers is a solutio to the liear equatio m =3, iff xy=3. Thus, we may use either two a s ad oe b or two b s ad oe a to form all the three letter words out of the two-elemet set {a, b}. Each of these two possibilities (by our discussio of permutatios of objects, ot ecessarily distict, i Bloc ) give 3!/!!=3 distict words vi. aab, aba, baa i the first case, ad bba, bab, abb i the secod, for a total of six words. Now, could we say that the umber of distict possibilities i the problem above is merely the umber of positive iteger solutios to the liear equatio m =3, if we thi of this as usig m a s ad b s, where m,? This would have bee so if we had ot bee iterested i the positio of a ad b, i which case aab ad aba would mea the same to us. But this is ot the case. We are cosiderig the umber of three-letter words i.e., differet strigs of three letters. So, the positio of the letters is importat. Cosequetly, we would lie each iteger solutio to cotribute ot but 3 (so total is 3!) to the total umber of words. 3

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

Module 8-7: Pascal s Triangle and the Binomial Theorem

Module 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 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

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

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

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

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

Alpha Individual Solutions MAΘ National Convention 2013

Alpha Individual Solutions MAΘ National Convention 2013 Alpha Idividual Solutios MAΘ Natioal Covetio 0 Aswers:. D. A. C 4. D 5. C 6. B 7. A 8. C 9. D 0. B. B. A. D 4. C 5. A 6. C 7. B 8. A 9. A 0. C. E. B. D 4. C 5. A 6. D 7. B 8. C 9. D 0. B TB. 570 TB. 5

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

On Infinite Groups that are Isomorphic to its Proper Infinite Subgroup. Jaymar Talledo Balihon. Abstract

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

Recursive Procedures. How can you model the relationship between consecutive terms of a sequence?

Recursive Procedures. How can you model the relationship between consecutive terms of a sequence? 6. Recursive Procedures I Sectio 6.1, you used fuctio otatio to write a explicit formula to determie the value of ay term i a Sometimes it is easier to calculate oe term i a sequece usig the previous terms.

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

Pattern Recognition Systems Lab 1 Least Mean Squares

Pattern 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 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

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

Ch 9.3 Geometric Sequences and Series Lessons

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

Counting Regions in the Plane and More 1

Counting 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 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

Lecture 2: Spectra of Graphs

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

Counting II 3, 7 3, 2 3, 9 7, 2 7, 9 2, 9

Counting II 3, 7 3, 2 3, 9 7, 2 7, 9 2, 9 Coutig II Sometimes we will wat to choose objects from a set of objects, ad we wo t be iterested i orderig them For example, if you are leavig for vacatio ad you wat to pac your suitcase with three of

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

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

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

. 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

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

Arithmetic Sequences

Arithmetic Sequences . Arithmetic Sequeces COMMON CORE Learig Stadards HSF-IF.A. HSF-BF.A.1a HSF-BF.A. HSF-LE.A. Essetial Questio How ca you use a arithmetic sequece to describe a patter? A arithmetic sequece is a ordered

More information

Algorithm Design Techniques. Divide and conquer Problem

Algorithm Design Techniques. Divide and conquer Problem Algorithm Desig Techiques Divide ad coquer Problem Divide ad Coquer Algorithms Divide ad Coquer algorithm desig works o the priciple of dividig the give problem ito smaller sub problems which are similar

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

Polynomial 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

Polynomial 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 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

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

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

Protected points in ordered trees

Protected 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 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

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

Mathematical Stat I: solutions of homework 1

Mathematical 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 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

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

NTH, GEOMETRIC, AND TELESCOPING TEST

NTH, GEOMETRIC, AND TELESCOPING TEST NTH, GEOMETRIC, AND TELESCOPING TEST Sectio 9. Calculus BC AP/Dual, Revised 08 viet.dag@humbleisd.et /4/08 0:0 PM 9.: th, Geometric, ad Telescopig Test SUMMARY OF TESTS FOR SERIES Lookig at the first few

More information

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

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

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

SEQUENCES AND SERIES

SEQUENCES AND SERIES SEQUENCES AND SERIES U N I The umber of gifts set i the popular Christmas Carol days of Christmas form a sequece. A part of the sog goes this way O the th day of Christmas my true love gave to me drummers

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

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

Major CSL Write your name and entry no on every sheet of the answer script. Time 2 Hrs Max Marks 70

Major 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 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

Name of the Student: Unit I (Logic and Proofs) 1) Truth Table: Conjunction Disjunction Conditional Biconditional

Name of the Student: Unit I (Logic and Proofs) 1) Truth Table: Conjunction Disjunction Conditional Biconditional SUBJECT NAME : Discrete Mathematics SUBJECT CODE : MA 2265 MATERIAL NAME : Formula Material MATERIAL CODE : JM08ADM009 (Sca the above QR code for the direct dowload of this material) Name of the Studet:

More information

Assignment 5; Due Friday, February 10

Assignment 5; Due Friday, February 10 Assigmet 5; Due Friday, February 10 17.9b The set X is just two circles joied at a poit, ad the set X is a grid i the plae, without the iteriors of the small squares. The picture below shows that the iteriors

More information

EVALUATION OF TRIGONOMETRIC FUNCTIONS

EVALUATION OF TRIGONOMETRIC FUNCTIONS EVALUATION OF TRIGONOMETRIC FUNCTIONS Whe first exposed to trigoometric fuctios i high school studets are expected to memorize the values of the trigoometric fuctios of sie cosie taget for the special

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

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

CSC 220: Computer Organization Unit 11 Basic Computer Organization and Design

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

Math 10C Long Range Plans

Math 10C Long Range Plans Math 10C Log Rage Plas Uits: Evaluatio: Homework, projects ad assigmets 10% Uit Tests. 70% Fial Examiatio.. 20% Ay Uit Test may be rewritte for a higher mark. If the retest mark is higher, that mark will

More information

MATHEMATICAL METHODS OF ANALYSIS AND EXPERIMENTAL DATA PROCESSING (Or Methods of Curve Fitting)

MATHEMATICAL METHODS OF ANALYSIS AND EXPERIMENTAL DATA PROCESSING (Or Methods of Curve Fitting) MATHEMATICAL METHODS OF ANALYSIS AND EXPERIMENTAL DATA PROCESSING (Or Methods of Curve Fittig) I this chapter, we will eamie some methods of aalysis ad data processig; data obtaied as a result of a give

More information

Chapter 3 Classification of FFT Processor Algorithms

Chapter 3 Classification of FFT Processor Algorithms Chapter Classificatio of FFT Processor Algorithms The computatioal complexity of the Discrete Fourier trasform (DFT) is very high. It requires () 2 complex multiplicatios ad () complex additios [5]. As

More information

CHAPTER IV: GRAPH THEORY. Section 1: Introduction to Graphs

CHAPTER 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 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

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

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

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

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

Fast Fourier Transform (FFT) Algorithms

Fast Fourier Transform (FFT) Algorithms Fast Fourier Trasform FFT Algorithms Relatio to the z-trasform elsewhere, ozero, z x z X x [ ] 2 ~ elsewhere,, ~ e j x X x x π j e z z X X π 2 ~ The DFS X represets evely spaced samples of the z- trasform

More information

Math 3201 Notes Chapter 4: Rational Expressions & Equations

Math 3201 Notes Chapter 4: Rational Expressions & Equations Learig Goals: See p. tet.. Equivalet Ratioal Epressios ( classes) Read Goal p. 6 tet. Math 0 Notes Chapter : Ratioal Epressios & Equatios. Defie ad give a eample of a ratioal epressio. p. 6. Defie o-permissible

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

PLEASURE TEST SERIES (XI) - 04 By O.P. Gupta (For stuffs on Math, click at theopgupta.com)

PLEASURE TEST SERIES (XI) - 04 By O.P. Gupta (For stuffs on Math, click at theopgupta.com) wwwtheopguptacom wwwimathematiciacom For all the Math-Gya Buy books by OP Gupta A Compilatio By : OP Gupta (WhatsApp @ +9-9650 350 0) For more stuffs o Maths, please visit : wwwtheopguptacom Time Allowed

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

IMP: Superposer Integrated Morphometrics Package Superposition Tool

IMP: Superposer Integrated Morphometrics Package Superposition Tool IMP: Superposer Itegrated Morphometrics Package Superpositio Tool Programmig by: David Lieber ( 03) Caisius College 200 Mai St. Buffalo, NY 4208 Cocept by: H. David Sheets, Dept. of Physics, Caisius College

More information

5.3 Recursive definitions and structural induction

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

EE123 Digital Signal Processing

EE123 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 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

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

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

South Slave Divisional Education Council. Math 10C

South Slave Divisional Education Council. Math 10C South Slave Divisioal Educatio Coucil Math 10C Curriculum Package February 2012 12 Strad: Measuremet Geeral Outcome: Develop spatial sese ad proportioal reasoig It is expected that studets will: 1. Solve

More information

Σ P(i) ( depth T (K i ) + 1),

Σ P(i) ( depth T (K i ) + 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

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

BOOLEAN MATHEMATICS: GENERAL THEORY

BOOLEAN MATHEMATICS: GENERAL THEORY CHAPTER 3 BOOLEAN MATHEMATICS: GENERAL THEORY 3.1 ISOMORPHIC PROPERTIES The ame Boolea Arithmetic was chose because it was discovered that literal Boolea Algebra could have a isomorphic umerical aspect.

More information

INTERSECTION CORDIAL LABELING OF GRAPHS

INTERSECTION 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 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

Algorithms Chapter 3 Growth of Functions

Algorithms Chapter 3 Growth of Functions Algorithms Chapter 3 Growth of Fuctios Istructor: Chig Chi Li 林清池助理教授 chigchi.li@gmail.com Departmet of Computer Sciece ad Egieerig Natioal Taiwa Ocea Uiversity Outlie Asymptotic otatio Stadard otatios

More information

The Adjacency Matrix and The nth Eigenvalue

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

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

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

Sorting 9/15/2009. Sorting Problem. Insertion Sort: Soundness. Insertion Sort. Insertion Sort: Running Time. Insertion Sort: Soundness

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

Numerical Methods Lecture 6 - Curve Fitting Techniques

Numerical Methods Lecture 6 - Curve Fitting Techniques Numerical Methods Lecture 6 - Curve Fittig Techiques Topics motivatio iterpolatio liear regressio higher order polyomial form expoetial form Curve fittig - motivatio For root fidig, we used a give fuctio

More information

It just came to me that I 8.2 GRAPHS AND CONVERGENCE

It just came to me that I 8.2 GRAPHS AND CONVERGENCE 44 Chapter 8 Discrete Mathematics: Fuctios o the Set of Natural Numbers (a) Take several odd, positive itegers for a ad write out eough terms of the 3N sequece to reach a repeatig loop (b) Show that ot

More information

1. The lines intersect. There is one solution, the point where they intersect. The system is called a consistent system.

1. The lines intersect. There is one solution, the point where they intersect. The system is called a consistent system. Commo Core Math 3 Notes Uit Day Systems I. Systems of Liear Equatios A system of two liear equatios i two variables is two equatios cosidered together. To solve a system is to fid all the ordered pairs

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

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

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

Symmetric Class 0 subgraphs of complete graphs

Symmetric Class 0 subgraphs of complete graphs DIMACS Techical Report 0-0 November 0 Symmetric Class 0 subgraphs of complete graphs Vi de Silva Departmet of Mathematics Pomoa College Claremot, CA, USA Chaig Verbec, Jr. Becer Friedma Istitute Booth

More information

Evaluation scheme for Tracking in AMI

Evaluation scheme for Tracking in AMI A M I C o m m u i c a t i o A U G M E N T E D M U L T I - P A R T Y I N T E R A C T I O N http://www.amiproject.org/ Evaluatio scheme for Trackig i AMI S. Schreiber a D. Gatica-Perez b AMI WP4 Trackig:

More information

CMPT 125 Assignment 2 Solutions

CMPT 125 Assignment 2 Solutions CMPT 25 Assigmet 2 Solutios Questio (20 marks total) a) Let s cosider a iteger array of size 0. (0 marks, each part is 2 marks) it a[0]; I. How would you assig a poiter, called pa, to store the address

More information

LU Decomposition Method

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

Computer Science Foundation Exam. August 12, Computer Science. Section 1A. No Calculators! KEY. Solutions and Grading Criteria.

Computer Science Foundation Exam. August 12, Computer Science. Section 1A. No Calculators! KEY. Solutions and Grading Criteria. Computer Sciece Foudatio Exam August, 005 Computer Sciece Sectio A No Calculators! Name: SSN: KEY Solutios ad Gradig Criteria Score: 50 I this sectio of the exam, there are four (4) problems. You must

More information

Solutions to Final COMS W4115 Programming Languages and Translators Monday, May 4, :10-5:25pm, 309 Havemeyer

Solutions to Final COMS W4115 Programming Languages and Translators Monday, May 4, :10-5:25pm, 309 Havemeyer Departmet of Computer ciece Columbia Uiversity olutios to Fial COM W45 Programmig Laguages ad Traslators Moday, May 4, 2009 4:0-5:25pm, 309 Havemeyer Closed book, o aids. Do questios 5. Each questio is

More information

Python Programming: An Introduction to Computer Science

Python Programming: An Introduction to Computer Science Pytho Programmig: A Itroductio to Computer Sciece Chapter 1 Computers ad Programs 1 Objectives To uderstad the respective roles of hardware ad software i a computig system. To lear what computer scietists

More information