Computing the Quartet Distance between Evolutionary Trees in Time O(n log n)

Size: px
Start display at page:

Download "Computing the Quartet Distance between Evolutionary Trees in Time O(n log n)"

Transcription

1 Computing the Qurtet Distne etween Evolutionry Trees in Time O(n log n) Gerth Stølting Brol, Rolf Fgererg Christin N. S. Peersen Mrh 3, 2003 Astrt Evolutionry trees esriing the reltionship for set of speies re entrl in evolutionry iology, n quntifying ifferenes etween evolutionry trees is therefore n importnt tsk. The qurtet istne is istne mesure etween trees previously propose y Estrook, MMorris n Mehm. The qurtet istne etween two unroote evolutionry trees is the numer of qurtet topology ifferenes etween the two trees, where qurtet topology is the topologil sutree inue y four speies. In this pper, we present n lgorithm for omputing the qurtet istne etween two unroote evolutionry trees of n speies, where ll internl noes hve egree three, in time O(n log n). The previous est lgorithm for the prolem uses time O(n 2 ). Keywors: Evolutionry trees, istne mesures, qurtet istne, hierrhil eompositions. A preliminry version of this pper ppere in the proeeings of 12th Interntionl Symposium on Algorithms n Computtion [3]. BRICS (Bsi Reserh in Computer Siene, fune y the Dnish Ntionl Reserh Fountion), Deprtment of Computer Siene, University of Arhus, Ny Munkege, DK-8000 Århus C, Denmrk. E-mil: {gerth,rolf,storm}@ris.k. Prtilly supporte y the Future n Emerging Tehnologies progrmme of the EU uner ontrt numer IST (ALCOM-FT). Supporte y the Crlserg Fountion (ontrt numer ANS-0257/20).

2 1 Introution The evolutionry reltionship for set of speies n e esrie y n evolutionry tree, whih is roote tree where the leves orrespon to the speies, n the internl noes orrespon to speition events, i.e. the points in time where the evolution hs iverge in ifferent iretions. The iretion of the evolution is esrie y the lotion of the root, whih orrespons to the most reent ommon nestor for ll the speies, n the urtion of evolutionry perios is esrie y ssigning lengths to the eges. The true evolutionry tree for set of speies is most often unknown; estimting it from otinle informtion out the speies, e.g. genomi t, is of gret interest in evolutionry iology. The prolem of omputtionlly estimting spets of the true evolutionry tree requires moel esriing how to use the ville informtion out the speies in question. Given moel, the prolem of estimting spets of the true evolutionry tree is referre to s onstruting the evolutionry tree in tht moel. Mny moels n onstrution methos re ville, see [11, Chpter 17] for n overview. An importnt spet of the true evolutionry tree for set of speies is its unirete tree topology inue y ignoring the lotion of the root n the length of the eges. Mny moels n methos re onerne with estimting just this tree topology, usully uner the further ssumption tht ll internl noes hve egree three. We sy tht suh moels n methos re onerne with onstruting the unroote evolutionry tree of egree three for set of speies. For the reminer of this pper, n evolutionry tree will enote n unroote evolutionry tree of egree three. Different moels n methos often yiel ifferent estimtes of the evolutionry tree for the sme set of speies, n even the sme moel n metho n yiel ifferent evolutionry trees for the sme set of speies when pplie to ifferent informtion out the speies, e.g. ifferent genes. To stuy suh ifferenes in systemti mnner, one hs to e le to quntify ifferenes etween evolutionry trees using well-efine n effiient methos. One pproh use for ompring two evolutionry trees is to efine istne mesure etween two trees n ompre the two trees y omputing the istne etween them. Mny istne mesures hve een propose mong these re the symmetri ifferene metri [16], the nerest-neighor interhnge metri [19], the sutree trnsfer istne [1], the Roinson n Fouls metri [17], n the qurtet metri [9]. Eh istne mesure hs ifferent properties n reflets ifferent spets of iology, e.g. the sutree trnsfer istne is relte to the numer of reomintion events etween the two sets of speies. Brynt et l. in [6] rgue tht the qurtet metri hs severl ttrtive properties n oes not suffer from rwks of other istne mesures, suh s mesures se on trnsformtion opertions (e.g. the sutree trnsfer istne) not istinguishing etween trnsformtions tht ffet lrge numer of leves n trnsformtions tht ffet smll numer of leves. In this pper, we stuy the qurtet metri. For n evolutionry tree for set of n speies, the qurtet topology of four speies is the topologil sutree inue y these speies. In generl, there re four possile qurtet topologies, s shown in Figure 1. However, if we ssume tht ll internl noes hve egree three, then the right-most qurtet topology nnot our. It is well-known tht the omplete set of qurtet topologies is unique for given tree n tht the tree n e reovere from its set of qurtet topologies in polynomil time [7]. If the tree hs egree three, then, s oserve in [13], it n e reovere from its set of qurtet topologies in time O(n log n) using methos for onstruting n evolutionry tree in the experiment moel [4, 10, 12, 13, 15]. Given two evolutionry trees on the sme set of n speies, the qurtet istne etween them is the numer of sets of four speies for whih the qurtet topologies iffer in the two trees. Sine 1

3 Figure 1: The four possile qurtet topologies of speies,,, n. n Figure 2: The two orienttions of qurtet topology. there re ( n 4) sets of four speies, the qurtet istne n e lulte in time O(n 4 ) y exmining the sets one y one. Steel n Penny in [18] presente n lgorithm for omputing the qurtet istne in time O(n 3 ). Brynt et l. in [6] presente n improve lgorithm whih omputes the qurtet istne in time O(n 2 ). In this pper, we present n lgorithm whih omputes the qurtet istne in time O(n log n). Our solution is se on t struture relte to the t struture for ynmi expression trees [8], the extene smller-hlf trik [5], n the on-the-fly ompression of the t struture to filitte the use of the extene smller-hlf trik. The rest of the pper is orgnize s follows. In Setion 2, we introue qurtets n our strtegy for omputing the qurtet istne etween two unroote evolutionry trees. In Setion 3, we esrie n nlyze hierrhil eomposition of unroote trees whih is n essentil prt of the t struture use y our lgorithm. In Setion 4, we present the etils of our t struture. In Setion 5, we esrie n lgorithm with running time O(n log 2 n), whih will serve s sis for our finl lgorithm. In Setion 6, we present our finl lgorithm with running time O(n log n). 2 Terminology As mentione, we in this pper y n evolutionry tree men n unroote tree where ll noes re either leves (i.e. hve egree one) or hve egree three, n where the leves re uniquely lele y the elements of set S of speies. Let n enote the size of S. For n evolutionry tree T, the qurtet topology of set {,,, } S of four speies is the topologil sutree of T inue y these speies. In generl, the possile qurtet topologies for speies,,, re the four shown in Figure 1. Of these, the right-most oes not our in our setting, ue to the ssumption out ll internl noes hving egree tree. Hene, the qurtet topology is piring of the four speies into two pirs, efine y letting n e pir if mong the three pths in T from to respetively,, n, the pth to is the first to seprte from the others more formlly, the qurtet topology is two-set of two-sets {{, }, {, }}. Given two evolutionry trees T 1 n T 2 on the sme set S of speies, the qurtet istne etween the two trees is the numer of four-sets {,,, } S, for whih the qurtet topologies in T 1 n T 2 iffer. As there re ( n 4) ifferent four-sets in S, the qurtet istne n lso e lulte s ( n 4) minus the numer of four-sets for whih the qurtet topologies in T1 n T 2 re ientil. In this pper, we show how to fin this numer in time O(n log n). To filitte the ounting of ientil qurtet topologies in the two trees, we view the qurtet topology of four-set {,,, } s two oriente qurtet topologies given y the two possile 2

4 v Figure 3: A generi qurtet. C A v B Figure 4: Sutrees inient to n internl noe v. orienttions of the mile ege of the topology. Figure 2 shows the two oriente qurtet topologies rising from one non-oriente qurtet topology. More formlly, n oriente qurtet topology is n orere pir of two-sets ({, }, {, }). Clerly, the numer of ientil oriente qurtet topologies etween the trees T 1 n T 2 is twie the numer of ientil non-oriente qurtet topologies. The gol of our lgorithm is to ount ientil oriente qurtet topologies. For revity, we in the rest of this pper let the wor qurtet enote n oriente qurtet topology of four-set, n use the nottion for ({, }, {, }). There re 2 3 (n 4) possile qurtets of S, of whih ny evolutionry tree T ontins suset Q T of size 2 (n 4). We ssoite the qurtets in Q T1 with internl noes in T 1 s follows: Consier the generi qurtet in Figure 3. There is unique noe v in T 1 where the pths from n to (n ) meet. We ssoite the qurtet with the noe v. This prtitions Q T1 into n 2 isjoint sets, s there re n 2 internl noes in tree of n leves, when ll internl noes hve egree three. For n internl noe v in T 1, we y Q v enote the set of qurtets ssoite with v. For n internl noe v in T 1, we y the sutrees inient to v men the three sutrees whih rise if v n its three inient eges re remove from T 1. These re shown in Fig 4, enote y A, B, n C. The numer of qurtets ssoite with v is given y the expression ( ) ( ) ( ) A B C B C + A C + A B, where T enotes the numer of leves in sutree T. The three terms of the expression re the numer of qurtets where n (in Figure 3) re in respetively the sutree A, B, n C (in Figure 4). Our strtegy for omputing the qurtet istne etween T 1 n T 2 is for eh internl noe v in T 1 to ount how mny of the qurtets ssoite with v whih re lso qurtets of T 2. The sum over ll internl noes in T 1 of these ounts then gives the require numer of ientil qurtets in T 1 n T 2. In other wors, we use the ft tht Q T1 Q T2 = v T 1 Q v Q T2. To implement the ove strtegy, we onstrut n lgorithm whih olors the elements of S using the three olors A, B, n C. We relte the oloring n the qurtets to eh other y the following two efinitions: For n internl noe v in T 1, we sy tht the elements of S re olore 3

5 oring to v if the lels of the leves of one of the three sutrees inient to v ll hve olor A, the lels of the leves of nother of the sutrees ll hve olor B, n the lels of the leves of the remining sutree ll hve olor C. For oloring of the elements in S n qurtet, we sy tht the qurtet is omptile with the oloring if n hve ifferent olors, n n oth hve the remining olor. From these efinitions the lemm elow is immeite. Lemm 1 When S is olore oring to hoie of v in T 1, then the set of possile qurtets of S tht re omptile with the oloring is extly the set Q v of qurtets ssoite with v. From Lemm 1, it follows tht if the oloring of S is oring to hoie of v in T 1, then the qurtets in T 2 omptile with the oloring re extly the qurtets ssoite with v whih re in oth T 1 n T 2. We mintin the oloring vi t struture esrie in Setion 4. The entrl feture of the t struture is tht it n in onstnt time return the numer of qurtets in T 2 omptile with the urrent oloring. The t struture lso llows the olor of k elements to e hnge in time O(k + k log n k ), given k pointers to the elements. For eh noe v in T 1 the lgorithm will ensure oloring oring to v n then query the t struture to fin the numer of qurtets ssoite with v tht lso re qurtets of T 2. 3 Hierrhil Deomposition An essentil prt of the t struture in Setion 4 is hierrhil eomposition of the evolutionry tree T 2. In the following, we esrie how to otin well lne hierrhil eomposition of ny unroote tree T with noes of egree t most three. Our eomposition is relte to the eompositions use for solving the prllel n ynmi expression tree evlution prolems [2, 8], ut in our setting the unerlying tree is unroote. The hierrhil eomposition is se on the notion of omponents. A omponent C in T is onnete suset of noes in T. An externl ege of C is n ege in T onneting noes in C n T \ C, i.e. n ege rossing the ut efine y C. The egree of C is its numer of externl eges. We llow only the following two types of omponents: 1. Components ontining single noe of T. 2. Components of egree t most two. We let eh noe of T (inluing leves) onstitute omponent of type 1. Components of type 2 re forme s the union of two jent omponents C n C, where C n C re si to e jent if there exists n ege (u, v) in T suh tht u C n v C. We ll suh union omposition. Eh omposition of two omponents orrespons to unique ege in the tree T, nmely the ege onneting the two omponents. We llow only the four ompositions epite in Figure 5, where noes represent ontrte omponents n ovls represent ompositions. Types (i), (iii), n (iv) re the ses where omponent with egree one is ompose with omponent of egree three, two, n one respetively. Type (ii) is the se where two omponents with egree two re ompose into new omponent with egree two. Note tht these ompositions will only proue omponents of egree t most two. A hierrhil eomposition of T is set of omponents proue uring some sequene of ompositions, strting from n initil set ontining one type 1 omponent for eh noe in T. If 4

6 (i) (ii) (iii) (iv) Figure 5: The four possile types of ompositions of omponents. iii iv ii iii iii i i i i f e f e Figure 6: A hierrhil eomposition of tree T with eight noes n the orresponing hierrhil eomposition tree H(T ) with eight leves. Eh noe in the hierrhil eomposition tree orrespons to omponent in the hierrhil eomposition of the tree. The lels re the types of ompositions use. we ontrt omponents to single noes fter eh omposition, the ompositions orrespon to ege ontrtions. As new omponents hve egree t most two, we in this ontrte view lwys hve tree with noes of egree t most three. We n therefore lwys pply omposition of type (i), (iii), or (iv), unless we lrey hve single omponent ontining ll of T. For hierrhil eompositions tht inlue omponent ontining ll of T, we my in nturl wy view the eomposition s roote inry tree H(T ), whih we ll hierrhil eomposition tree for T. Eh noe of H(T ) represents omponent in the eomposition. Leves of H(T ) represent the omponents of type 1 in one-to-one fshion, n n internl noe v of H(T ) represents omponent of type 2 forme y the omposition of the two omponents represente y the hilren of v. Figure 6 shows hierrhil eomposition of tree T n the orresponing hierrhil eomposition tree H(T ). We will show how to onstrut hierrhil eomposition trees whih re lolly-lne. A roote inry tree with n noes is -lolly-lne if for ll noes v in the tree, the height of the sutree roote t v is t most (1 + log v ), where v is the numer of leves in the sutree roote t v n height is the mximl numer of eges on ny root-to-lef pth. For lollylne inry trees, Lemm 2 elow hols. This property is essentil for the use of the extene smller-hlf trik in the finl lgorithm in Setion 6. 5

7 Lemm 2 The union of k root-to-lef pths in -lolly-lne roote inry tree with n leves ontins t most k(3 + 4) + 2k log n k noes. Proof. Let T e -lolly-lne inry tree with n leves, n N(n, k, ) e the mximl numer of eges in the union of k root-to-lef pths in suh tree. We first give n upper oun on the numer of eges whih le to extly one of the k leves. The eges onstitute set of k pths P 1,..., P k, suh tht eh pth strts t some internl noe n les to extly one of the k leves. If (u i, v i ) is the first ege in pth P i, then P i is the only pth ontining eges from the sutree roote t v i, n we hve P i 1 + h(v i ) log v i, where h(v i ) n v i re the height n size of the sutree roote t v i, n P i is the numer of eges in P i. Sine the sutrees roote t v 1,..., v k re isjoint, we hve v v k n, so y the onvexity of the logrithm we get the following oun on the numer of eges leing to extly one lef. k k k P i (1 + + log v i ) = k + k + log v i k + k + k log n k. i=1 i=1 i=1 The eges leing to t lest two of the k leves onstitute sutree T of T with t most k/2 leves, sine lef of T is n internl noe v of T where oth the eges to the hilren of v le to extly one of the k leves. Hene, T is ontine in the union of t most k/2 of the pths P 1,..., P k, n we get the reurrene N(n, k, ) k + k + k log n k + N(n, k/2, ), with N(n, 1, ) = + log n. Using the ft tht 2x + x log n x is inresing in x for 0 < x n, we y inution get N(n, k, ) 2k + 4k + 2k log n k. As pth with t eges ontins t + 1 noes, the union of the k pths ontins t most k(3 + 4) + 2k log n k noes. We now esrie how to onstrut lolly-lne hierrhil eomposition trees in liner time. Lemm 3 For ny unroote tree T with n noes of egree t most three, (1/ log )-lollylne hierrhil eomposition tree H(T ) n e ompute in time O(n). Proof. Given n unroote tree with n noes, we onstrut hierrhil eomposition tree ottomup in O(log n) rouns. Eh roun performs numer of ompositions of types (i) (iv), n hene proues new set of omponents whih forms tree with noes of egree t most three. This tree is the sis for the next roun. Before the first roun, eh noe in T is omponent y itself. In eh roun, we y trversl of the tree greeily selet n ritrry mximl set of non-overlpping ompositions, using time liner in the size of the tree, i.e. in the numer of remining omponents. Sine one of the ompositions (i), (iii), n (iv) n lwys e pplie if there re t lest two omponents left, this lgorithm will eventully terminte with single omponent representing the entire tree. Let v e noe in the onstrute hierrhil eomposition tree, n let m e the numer of noes of T in the omponent C represente y v. We will rgue tht the height of the sutree roote t v is O(log m) y rguing tht the onstrution of C hs een one in O(log m) rouns. If m = 1, the height is zero. If m = 2, there re three ses: If C hs no externl eges then type (iv) hs een pplie, if C hs one externl ege then type (iii) hs een pplie, n if C hs two externl eges then types (i) or (ii) hs een pplie. In either se, the height is one. 6

8 So ssume m 3. Let t enote the numer of externl eges of C, n let m 1, m 2, n m 3 enote the numer of noes ontine in C tht re of egree one, two, n three in T. For tree with noes of egree t most three, the numer of egree three noes is extly two less thn the numer of egree one noes. In prtiulr, this hols for tree onsisting of the noes n eges insie C, plus the t externl eges eh terminte y egree one noe. This implies the reltion m 3 = m 1 + t 2. As t 2, we hve m 3 m 1. There re m 1 eges insie C, s C onstitute tree. Of these, the only eges not orresponing to legl ompositions re eges onneting noe of egree three with noe of egree two or three. There re t most 3m 3 suh eges. The numer of possile ompositions is therefore t lest m 1 3m 3 m 1 3m 1. In the se m 1 < m/6, this oun is lrger thn 3m/6 1. As m 3, this is t lest m/6. Otherwise, we hve the se m 1 m/6. Sine m 3, there re lwys m 1 possile ompositions of types (i) n (iii). In oth ses, there re t lest m/6 possile ompositions on eges in C. Sine eh possile omposition n e in onflit with t most two other possile ompositions (f. Figure 5), ny mximl set of non-onfliting ompositions hosen in the first roun of the onstrution lgorithm ontins t lest m/18 eges in C. The nlysis ove lso pplies to susequent rouns, exept tht it shoul use vlues m 1, m 2, m 3, n m enoting the urrent numer of omponents within C of egree one, two, n three, n their sum, respetively. The onstrution of omponent C strts with m omponents orresponing to single noes. After k rouns, t most m(17/18) k omponents remin. In prtiulr, one omponent remins fter t most log 18/17 m steps, so the height of the sutree roote t v is oune y log 18/17 m (1/ log )(1 + log m). Finlly, onsier the time it tkes to onstrut the hierrhil eomposition tree, i.e. the time it tkes to onstrut the omponent represente y the root in the hierrhil eomposition tree. Let n e the numer of noes in this omponent. The onstrution of this omponent tkes log 18/17 n rouns, where eh roun tkes time proportionl to the numer of omponents remining. Initilly, there re n omponents orresponing to single noes. Sine the numer of omponents ereses geometrilly in eh roun, the totl time eomes O(n). In the following lemm, we re not onerne with the lne of hierrhil eompositions, ut rther with how they n e use to ontrt the noes of tree while leving esignte set of leves untouhe. Lemm 4 Let T e n unroote tree with n noes of egree t most three, n let k 0 leves e mrke s non-ontrtile. In O(n) time hierrhil eomposition of T into t most 4k + 1 omponents n e ompute suh tht eh mrke lef is omponent y itself. Proof. We onstrut the eomposition y repetely pplying vli ompositions (f. Figure 5) on n initil set of omponents onsisting of the n noes of T. Sine eh vli omposition orrespons to n ege of T, this lgorithm tkes O(n) time if we mintin queue of eges orresponing to vli ompositions. Consier sitution where the lgorithm stops, i.e. where there re no more eges orresponing to vli ompositions. We must rgue tht there re t most 4k + 1 omponents. Let n 1, n 2, n n 3 e the numer of omponents of egree one, two, n three respetively. If n 3 = 0, the tree is pth n we hve k n 1 2. The numer of eges where we nnot pply eomposition is t most k, so the numer of omponents is t most k + 1 4k + 1. If n 3 1, we rgue s follows. If n 1 > k, then t lest one lef is ontrtile, n omposition of type (i) or (iii) n y pplie. So the only omponents of egree one re the k mrke leves, n we hve n 1 = k n n 3 = n 1 2 = k 2. The only eges not orresponing to vli ompositions re eges inient to mrke lef, or eges inient to omponent of egree three (f. the proof 7

9 C B ext. ege 1 ext. ege 2 A A f e A B inue sutree 1 C B B A A A f e inue sutree 2 Figure 7: A omponent in the hierrhil eomposition with two externl eges. The omponent orrespons to the mrke noe in the hierrhil eomposition tree to the right. This noe is eorte with informtion (0, 1, 1) n F ( 1, 1, 1, 2, 2, 2 ), where i, i, n i enote the numer of elements in leves from the sutree inue y externl ege i whih re olore A, B, n C, respetively. In the figure, ( 1, 1, 1, 2, 2, 2 ) = (1, 1, 0, 2, 0, 0). F sttes, s funtion of the vriles i, i, n i, the numer of the qurtets whih re oth ssoite with noes in the omponent n re omptile with the given oloring. For the highlighte omponent these re the qurtets ef, ef, e, n f. In totl there re four qurtets tht re oth ssoite with noes in the omponent n re omptile with the given oloring, i.e. F (1, 1, 0, 2, 0, 0) = 4. of Lemm 3), i.e. t most k + 3n 3 = 4k 6 eges o not represent vli ompositions. As the omponents form tree, the numer of omponents is t most 4k 5 4k Counting Qurtets in Components Let T e n evolutionry tree n H(T ) e hierrhil eomposition tree for T. We now esrie how to eorte the noes of H(T ) with informtion suh tht the numer of qurtets of T whih re omptile with given oloring of S n e returne in onstnt time. Furthermore, for given oloring, the eortion n e generte in O(n) time, n if k elements of S hnge olor, the eortion n e upte in time O(k + k log n k ). For eh noe of H(T ), we store tuple (,, ) of integers n funtion F. Rell tht noe in H(T ) represents omponent in T. The integers,, n of the tuple re the numer of elements t the leves of T ontine in this omponent whih re olore A, B, n C, respetively. A omponent hs k externl eges for k etween zero n three (the se of zero externl eges ours only t the root of H(T )). The funtion F hs three vriles for eh of the externl eges of the omponent. For omponent with k 1 externl eges, we numer these eges ritrrily from 1 to k n enote the three vriles orresponing to ege i y i, i, n i. If n externl ege ws remove from T, two sutrees of T woul rise, where one oes not ontin the omponent in question. We ll this sutree the sutree inue y the externl ege. The vriles i, i, n i enote the numer of elements in leves from the sutree inue y ege i whih re olore A, B, n C, respetively. Finlly, F sttes, s funtion of the vriles i, i, n i, for 1 i k, the numer of the qurtets whih re oth ssoite (s efine in Setion 2) with noes in the omponent n re omptile with the given oloring. It will turn 8

10 out tht F is tully polynomil of totl egree t most four (the totl egree of monomil is the sum of the powers of its vriles, n the totl egree of polynomil is the mximum of this over its monomils for exmple, the totl egree of x 3 y 3 + x 4 z is six). Figure 7 gives n exmple of the esrie eortion. The root of H(T ) represents omponent whih omprises the entire tree T. This omponent hs no externl noes, so the funtion F store there is onstnt. Hene, the numer of qurtets of T whih re omptile with given oloring of S is prt of the informtion store t the root of H(T ). Lemm 5 The tree H(T ) n e eorte with the informtion esrie ove in time O(n). Proof. The informtion is ompute in ottom up fshion uring trversl of H(T ). We first esrie how the informtion for leves in H(T ) is generte, i.e. for noes representing single noe omponents. Rell tht noe in T is either lef n hs egree one, or is n internl noe n hs egree three. For omponent onsisting of single lef with n element olore A, B, or C, the tuple is (1, 0, 0), (0, 1, 0), n (0, 0, 1), respetively. The funtion F is ientilly zero, s qurtets re only ssoite with internl noes of T, not with leves of T. For omponent onsisting of single egree three noe u, the tuple is (0, 0, 0), s no leves of T re ontine in the omponent. The funtion F shoul ount the numer of qurtets whih re oth omptile with the oloring n ssoite with u in T. A qurtet fulfills this requirement preisely when n re ontine in one of the three sutrees inue y the externl eges of the omponent, n they hve the sme olor, n n eh re in one of the remining two inue sutrees n eh hve one of the remining two olors. For the se tht n re in the sutree inue y ege numer one n hve olor A, the numer of qurtets fulfilling this is ( ) 1 2 ( ). Summing over ll 3 3 = 9 hoies of the inue sutree n olor for n, we get: F ( 1, 1, 1, 2, 2, 2, 3, 3, 3 ) = ( ) 1 2 ( ) + ( ) 2 2 ( ) + ( ) 3 2 ( ) + ( ) 1 2 ( ) + ( ) 2 2 ( ) + ( ) 3 2 ( ) + ( ) 1 2 ( ) + ( ) 2 2 ( ) + ( ) 3 2 ( ) We now turn to the genertion of the informtion store in the internl noes of H(T ). Consier the omposition of two omponents C n C. Let (,, ) n F, n (,, ) n F e the informtion store t the noes representing the omponents C n C. The informtion store t the noe representing the omposition C of C n C is ( +, +, + ) n F, where F epens on the type of omposition. If the omponent omposition is of type (ii), we onsier the se where the numering of externl eges of omponents is suh tht the first externl ege of C n C is the ege onneting C n C, n the seon externl ege of C is the first externl ege of C, n the seon externl ege of C is the seon externl ege of C. The remining 9

11 ses of numering of externl eges re otine y pproprite hnges of the rguments to F n F. F ( 1, 1, 1, 2, 2, 2 ) = F ( 2 +, 2 +, 2 +, 1, 1, 1 ) + F ( 1 +, 1 +, 1 +, 2, 2, 2 ) Component ompositions of type (iii) n (iv) re ientil to type (ii), exept tht the efinition of F is simpler. For type (iii) we hve (ssuming tht C is the omponent of egree one) n for type (iv) we hve F ( 1, 1, 1 ) = F (,,, 1, 1, 1 ) + F ( 1 +, 1 +, 1 + ), F = F (,, ) + F (,, ). Note tht for type (iv) ompositions, F is onstnt. Finlly, we for type (i) ompositions get the following expression for F, ssuming C hs egree one n the first n seon externl eges of C re the seon n thir externl eges of C, respetively. F ( 1, 1, 1, 2, 2, 2 ) = F ( , , ) + F (,,, 1, 1, 1, 2, 2, 2 ) Note tht the funtion F for omponent onsisting of single noe is polynomil with t most nine vriles n totl egree t most four. By struturl inution on the efinition of the F funtions, the sme is seen to hol for ll omponents. Polynomils with t most nine vriles n totl egree t most four n e store in onstnt spe y storing the oeffiients, n they n e mnipulte in onstnt time, e.g. when ing or omposing two polynomils. Atully, it n e shown tht exept for omponents of egree three, the polynomils hve t most six vriles n totl egree t most three 1. As ll omponents of egree three hve n F of fixe form, the spe require to store the polynomils is less thn implie y the oun stte ove. We onlue tht for omponent C whih is the omposition of two omponents C n C, the informtion to e store t C n e ompute in onstnt time, provie tht the informtion store t C n C is known. It follows tht H(T ) n e eorte in time O(n). Lemm 6 The eortion of H(T ) n e upte in O(k + k log n k ) time when the olor of k elements in S hnges. Proof. From the proof of Lemm 5 we know tht the eortion of noe in H(T ) only epens on the eortion of the hilren of the noe in H(T ), i.e. the only eortions tht nee to e upte in H(T ) while hnging the olor of n element in S re the eortions of the nestors of the lef in H(T ) orresponing to the element. The eortion of noe tkes onstnt time to ompute knowing the eortion of the hilren. Sine H(T ) is (1/ log )-lolly lne tree, we from Lemm 2 hve tht t most O(k + k log n k ) noes shoul e upte. We first mrk the 1 For instne, the ext formt of omponents with two externl eges with vriles ( 1, 1, 1) n ( 2, 2, 2) n y struturl inution e shown to e F ( 1, 1, 1, 2, 2, 2) = (k 0 + k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k )/2, where k 0, k 1,..., k 33 re integer oeffiients. 10

12 Proeure Count(v) if v is lef then olor v y the olor C return 0 else ColorLeves(Smll(v), B) x = NoeCount(v) ColorLeves(Smll(v), C) y = Count(Lrge(v)) ColorLeves(Smll(v), A) z = Count(Smll(v)) return x + y + z Figure 8: The si lgorithm. noes to e upte ottom-up from eh lef until we fin the first lrey mrke noe. The eortions of the mrke noes re then upte ottom-up y trversl of the mrke noes, simultneously with removing the mrks gin. In totl, we spen time proportionl to the numer of noes to e upte. 5 The Bsi Algorithm In this setion, we give n lgorithm with running time O(n log 2 n). The lgorithm strts y rooting T 1 t n ritrry lef. It then lultes the size v of eh noe v in T 1 uring postorer trversl strting t the root, where v enotes the numer of leves elow v, n stores this informtion in the noes. It lso olors ll elements of S y the olor A, exept for the root whih is olore C, n uils H(T 2 ) with eortion se on this oloring. The lgorithm then reursively lultes the sum esrie in Setion 2 of ounts for ll internl noes of T 1, strting t the single hil of the root of T 1. To hieve the lime omplexity, the lgorithm t noe v will mke reursive ll first on its lrger hil, then on its smller hil, n finlly the ount for v to the sum lulte so fr. In Figure 8 the lgorithm is esrie in pseuo-oe s reursive proeure Count(v). A ll to Count(v) returns the sum of the ounts for v n the internl noes of T 1 elow v. Initilly, it is lle with v set to the single hil of the root of T 1. The routines Smll(v) n Lrge(v) return the hil of v hving smllest n lrgest size respetively. The routine NoeCount(v) is ll to the t struture of Setion 4, whih returns the ount for the noe v y looking t the urrent informtion t the root of H(T 2 ). The routine ColorLeves(v, X ) olors y the olor X ll elements in the t struture whih re lels of leves elow v in T 1. This is one y trversl of the sutree in T 1 roote t v. By mintining i-iretionl pointers etween elements of S in the t struture n the leves in T 1 n T 2 whih they lel, this n e one in the time stte in Lemm 6 with k equl to v. See Figure 9 for n illustrtion of the t strutures use y the 11

13 T 2 T 1 e f f e H(T 2 ) roote T 1 f e f e Figure 9: The t strutures use y the si lgorithm re the hierrhil eomposition tree H(T 2 ) eorte with informtion s esrie in Setion 4, n the tree T 1 roote t n ritrry lef. Pointers re mintine etween elements of S in H(T 2 ) n noes of egree one in T 1. si lgorithm. Theorem 1 Let T 1 n T 2 e two unroote evolutionry trees on the sme set S of speies, n let ll internl noes in the trees hve egree three. Then the qurtet istne etween T 1 n T 2 n e foun in time O(n log 2 n). Proof. By inution on time, it follows tht the lgorithm ove mintins the invrints: 1. At the eginning of the exeution of n instne of Count(v), ll elements in S whih re lels of leves elow v in T 1 re olore A, n ll other elements in S re olore C. 2. At the en of the exeution of n instne of Count(v), ll elements in S re olore C. The invrints imply tht when ll to NoeCount(v) tkes ple, lels of leves in the sutree of Smll(v) re lele y the olor B, lels of leves in the sutree of Lrge(v) re lele y the olor A, n the remining elements re lele y the olor C. In other wors, the elements of S re olore oring to v. From the isussion in Setion 2, we hve tht the qurtet istne equls ( n 4) minus hlf the vlue ompute y the lgorithm ove. For omplexity, note tht the work inurre y n instne of Count(v), not ounting reursive lls me uring this instne, is O(log n Smll(v) ), y the logrithmi height of H(T 2 ). Let this work e ounte for y hrging eh lef elow Smll(v) in T 1 (or v itself, if it is lef) 12

14 n mount of O(log n) work. For given lef, this hrging n only hppen t noes v on the pth from the lef to the root where the pth goes from Smll(v) to v. As the size of v is t lest twie s lrge s the size of Smll(v), this n only hppen log n times. Hene, eh lef is t most hrge O(log 2 n) work in totl, n the result follows. 6 The Improve Algorithm In the nlysis of our si lgorithm in the previous setion, we me use of the ft tht if eh noe v in inry tree with n leves supplies term Smll(v), then the sum over ll noes in the tree is O(n log n). In the literture, this is often referre to s the smller-hlf trik. We use it with = log n. In this setion, we improve the ove lgorithm to n lgorithm with running time O(n log n). The improvement omes from hnges in the lgorithm whih will llow us to use n extene smller-hlf trik. This stronger result is hinte t in [14, Exerise 35] n formulte in Lemm 7 elow. As usul, full inry tree is tree where eh internl noe hs two hilren. Lemm 7 Let T e full inry tree with n leves. If v = Smll(v) log( v / Smll(v) ) for every internl noe v, n v = 0 for every lef v, then v n log n. v T Proof. The proof is y inution on the size of T. If T = 1, the lemm hols vuously. Now ssume inutively tht the upper oun hols for ll trees with t most n 1 leves. Consier tree with n leves where the numer of leves in the sutrees roote t the two hilren of the root re k n n k where 0 < k n/2. Aoring to the inution hypothesis the sum over ll noes in these two sutrees is oune y respetively k log k n (n k) log(n k). The entire sum is thus oune y: whih proves the lemm. k log(n/k) + k log k + (n k) log(n k) = k log n + (n k) log(n k) < k log n + (n k) log n = n log n, The improvement of the si lgorithm is se on the following oservtion: In reursive ll to Count(v), only the leves elow v in T 1 n e olore with olor ifferent from C, i.e. if v is smll then most omponents in H(T 2 ) only ontin noes olore C. By ontrting suh omponents in T 2 into single noes, we y Lemm 4 n otin ontrte version of T 2 with t most 4 v + 1 noes. We use this oservtion to onstrut n improve lgorithm whih works with ontrte versions of T 2. By ontrting T 2 whenever onstnt frtion of the leves hs een olore C, nmely when T 2 > 5 v, we n gurntee tht T 2 = O( v ) when reursively invoking our improve lgorithm, inste of T 2 = n s in the si lgorithm. By Lemm 6, this implies tht upting the olors of Smll(v) y the three ColorLeves opertions tkes time O( Smll(v) log( v / Smll(v) )). Assuming tht this omintes the work inurre y n instne of our improve lgorithm, totl running time of O(n log n) is implie y Lemm 7. 13

15 Proeure FstCount(v, T ) lol vr T if v is lef then olor v y the olor C return 0 else ColorLeves(Smll(v), B, T ) x = NoeCount(v) T = Contrt(B, Extrt(Smll(v), T )) ColorLeves(Smll(v), C, T ) if T > 5 Lrge(v) then T = Contrt(A, T ) y = FstCount(Lrge(v), T ) ColorLeves(Smll(v), A, T ) z = FstCount(Smll(v), T ) return x + y + z Figure 10: The extene lgorithm. To voi the prolem of reversing the ontrtions of T 2 me long one pth in the reursion tree when nother pth is lter tken, we mke opies of T 2 uring the reursion. An input prmeter to the reursive proeure is therefore ompresse opy T of T 2, long with n ssoite hierrhil eomposition tree H(T ). In the initil ll, we hve T = T 2. In Figure 10, our improve lgorithm is esrie s reursive proeure FstCount(v, T ). In the pseuo-oe, T refers to the tree T s well s its ssoite t struture. A similr remrk pplies to the opy T. The ifferenes etween FstCount(v, T ) n Count(v) re the two pplitions of the routine Contrt n the single pplition of the routine Extrt. The routine Contrt(X, U) pplies the lgorithm esrie in the proof of Lemm 4 to the tree U, with the term non-ontrtile tken to men the leves in U olore X. It uses the eomposition resulting from this lgorithm s new tree y tking the omponents s the new noes, n the eges etween the omponents s the new eges. The (,, ) n F informtion of the omponents is inherite y the new noes. Finlly it uils the t struture for this ontrte tree using Lemm 3. By Lemm 3 n Lemm 4, the running time of Contrt(X, U) is O( U ). The routine Extrt(Smll(v), T ) uses the t struture of T to extrt opy of T t the point in the lgorithm where ll leves elow Smll(v) re olore B, ll leves in Lrge(v) re olore A, n the remining leves re olore C. In the opy, ll leves elow Smll(v) remin olore B n ll other leves re olore C, i.e. the olor of leves elow Lrge(v) hs een hnge from A to C. We give the etils of Extrt elow. The routine Contrt is pplie to the opy, n the resulting ontrte opy T of T is use for the susequent reursive ll on Smll(v). Just s in the si lgorithm, to perform ColorLeves we nee pointers etween leves in T 1 n elements of S in H(T ). However, in the extene lgorithm of Figure 10, the first two lls 14

16 to ColorLeves work on T, while the lst ll works on T. As prt of the onstrution of T, we therefore mke list where eh element points to lef elow Smll(v) in T 1 n to the orresponing element of S in T. Just efore the thir ll to ColorLeves, we trverse this list n upte the tul pointers in leves elow Smll(v) in T 1 to point to noes of T inste of T. For revity, this is not shown in Figure 10. We now give the etils of Extrt(Smll(v), T ). As esrie in Setion 3, the t struture of T is the inry tree struture H(T ). To extrt the opy from T, we mrk ll internl noes in H(T ) on pths from the leves of olor B to the root y mrking ottom-up from eh lef until we fin the first lrey mrke noe. We then trverse the mrke prt of the t struture, n ientify the sutrees tht woul rise if the mrke noes were remove. In H(T ), internl noes orrespon to eges in T, n sutrees orrespon to omponents of T of egree one, two, or three. Hene, the sutrees tht woul remin fter removl of the mrke noes re omponents of T of egree one, two, or three. For eh of these omponents, we rete new noe for the extrte tree with the sme egree s the omponent in T it orrespons to. These steps re illustrte s prt of Figure 11, whih gives n exmple of the onstrution of T. To e le to onsier ll leves in the omponents s eing olore C, we exten the efinition of the t struture in Setion 4 suh tht eh omponent lso stores funtion F C efine equivlently to the funtion F, exept tht it ssumes ll leves in the omponent to e olore C. If omponent efore the extrtion stores tuple (,, ) n funtions F n F C, then the orresponing noe in the extrte tree stores the tuple (0, 0, + + ) n the funtions F C n F C. We onnet two new noes v n u y n ege if n outgoing ege of the omponent orresponing to v is the sme ege s n outgoing ege of the omponent orresponing to u. Note tht the eges in ny T will e suset of the eges in the originl evolutionry tree T 2 (s Extrt n Contrt mintin this invrint). If the 2n 3 eges of the originl T 2 re lele with the integers 1,..., 2n 3, we n therefore onnet the noes in time proportionl to the numer of noes y using the lels of outgoing eges s inexes into n rry n onneting noes ening up in the sme entry. In totl, y Lemm 2, the extrtion tkes time O( Smll(v) log( T / Smll(v) )). When we perform the opertion Extrt(Smll(v), T ) on n instne of FstCount(v, T ), we hve enfore T = O( v ), n therefore Extrt(Smll(v), T ) is performe within the sme time oun O( Smll(v) log( v / Smll(v) )) s the three ColorLeves opertions. The extrte tree hs O( Smll(v) log( v / Smll(v) )) noes. By pplying the liner time routine Contrt to the extrte tree, we get n equivlent tree T of size t most 4 Smll(v) + 1. Theorem 2 Let T 1 n T 2 e two unroote evolutionry trees on the sme set S of speies, n let ll internl noes in the trees hve egree three. The qurtet istne etween T 1 n T 2 n e foun in time O(n log n) n spe O(n). Proof. The extene lgorithm FstCount(v, T ) oeys the sme invrints out the oloring s stte in the proof of Theorem 1. The orretness of FstCount(v, T ) thus follows from the orretness of Count(v). For time omplexity, we hve lrey oserve tht the three ColorLeves opertions n the single Extrt opertion n e performe in time O( Smll(v) log( v / Smll(v) )), whih y Lemm 7 (with T 1 for T ) mounts to time O(n log n) in totl uring the entire reursion of the topmost ll to FstCount(v, T 2 ). We now onsier the time spent ontrting T. We perform the T = Contrt(A, T ) opertion whenever T > 5 Lrge(v). Sine ll leves in Lrge(v) re olore A when we ontrt, the size of the ontrte T is t most 4 Lrge(v) + 1 y Lemm 4. Hene, the size of T is reue y ftor 4/5. This implies tht the sequene of ontrtions pplie to ny speifi opy of the 15

17 T 1 T (= T 2 ) B v C Smll(v) Lrge(v) A B f e f A A e H(T ) Extrt(Smll(v), T ) B T B {} {,, e, f} C B B A A A f e {e, f} A B B Figure 11: The onstrution of T in the extene lgorithm. The prtiulr se shown is from the first ll to FstCount, where T is ientil to T 2. The noes with rosses in H(T ) re the roots of sutrees ientifie uring Extrt(Smll(v), T ). The noes lele with sets of speies represent ontrte omponents of T, n these omponents re shown with she lines. 16

18 t struture results in sequene of t strutures of geometrilly eresing sizes. Sine ontrtion tkes time O( T ), the totl time spent on ontrting opy is liner in its initil size, i.e. it is ominte y the time for onstruting the opy y the Extrt routine. For spe omplexity, we oserve tht the spe onsumption is O(n) unless the opie trees onsume too muh spe. However, we oserve tht on ny pth in the reursion, i.e. pth in T 1, the sizes of the T trees rete t eh noe v in T 1 in the reursion hs size O( Smll(v) ) whih is oune y the size of the sutree in T 1 roote t the hil of v not in the reursion pth (either Smll(v) or Lrge(v)). This implies tht the extrte trees onsume spe O(n) in totl. Aknowlegment We thnk Mike Steel n n nonymous referee for etile omments on the presenttion. Referenes [1] B. L. Allen n M. Steel. Sutree trnsfer opertions n their inue metris on evolutionry trees. Annls of Comintoris, 5:1 13, [2] R. P. Brent. The prllel evlution of generl rithmeti expressions. Journl of the ACM, 21(2): , [3] G. S. Brol, R. Fgererg, n C. N. S. Peersen. Computing the qurtet istne etween evolutionry trees on time O(n log 2 n). In Proeeings of the 12th Interntionl Symposium on Algorithms n Computtion (ISAAC), volume 2223 of Leture Notes in Computer Siene, pges Springer-Verlg, [4] G. S. Brol, R. Fgererg, C. N. S. Peersen, n A. Östlin. The omplexity of onstruting evolutionry trees using experiments. In Proeeings of the 28th Interntionl Colloquium on Automt, Lnguges, n Progrmming (ICALP), volume 2076 of Leture Notes in Computer Siene, pges Springer-Verlg, [5] G. S. Brol n C. N. S. Peersen. Fining mximl qusiperioiities in strings. In Proeeings of the 11th Annul Symposium on Comintoril Pttern Mthing (CPM), volume 1848 of Leture Notes in Computer Siene, pges Springer-Verlg, [6] D. Brynt, J. Tsng, P. E. Kerney, n M. Li. Computing the qurtet istne etween evolutionry trees. In Proeeings of the 11th Annul ACM-SIAM Symposium on Disrete Algorithms (SODA), pges , [7] P. Bunemn. The reovery of trees from mesures of issimilirty. Mthemtis in Arheologil n Historil Sienes, pges , [8] R. F. Cohen n R. Tmssi. Dynmi expression trees. Algorithmi, 13(3): , [9] G. Estrook, F. MMorris, n C. Mehm. Comprison of unirete phylogeneti trees se on sutrees of four evolutionry units. Systemti Zoology, 34(2): , [10] M. Frh, S. Knnn, n T. J. Wrnow. A roust moel for fining optiml evolutionry trees. Algorithmi, 13(1/2): ,

19 [11] D. Gusfiel. Algorithms on Strings, Trees, n Sequenes: Computer Siene n Computtionl Biology. Cmrige University Press, [12] S. K. Knnn, E. L. Lwler, n T. J. Wrnow. Determining the evolutionry tree using experiments. Journl of Algorithms, 21(1):26 50, July [13] A. Lings, H. Olsson, n A. Östlin. Effiient merging, onstrution, n mintenne of evolutionry trees. In Proeeings of the 26th Interntionl Colloquium on Automt, Lnguges n Progrmming (ICALP), volume 1644 of Leture Notes in Computer Siene, pges Springer-Verlg, [14] K. Mehlhorn. Sorting n Serhing, volume 1 of Dt Strutures n Algorithms. Springer- Verlg, [15] J. Perl n M. Trski. Struturing usl trees. Journl of Complexity, 2:60 77, [16] D. F. Roinson n L. R. Fouls. Comprison of weighte lelle trees. In Comintoril mthemtis, VI (Proeeings of the 6th Austrlin Conferene, University of New Engln, Armile, 1978), Leture Notes in Mthemtis, pges Springer-Verlg, Berlin, [17] D. F. Roinson n L. R. Fouls. Comprison of phylogeneti trees. Mthemtil Biosienes, 53(1-2): , [18] M. Steel n D. Penny. Distriution of tree omprison metris some new results. Systemti Biology, 42(2): , [19] M. S. Wtermn n T. F. Smith. On the similrity of enrogrms. Journl of Theoretil Biology, 73: ,

COMPUTING THE QUARTET DISTANCE BETWEEN EVOLUTIONARY TREES OF BOUNDED DEGREE

COMPUTING THE QUARTET DISTANCE BETWEEN EVOLUTIONARY TREES OF BOUNDED DEGREE COMPUTING THE QUARTET DISTANCE BETWEEN EVOLUTIONARY TREES OF BOUNDED DEGREE M. STISSING, C. N. S. PEDERSEN, T. MAILUND AND G. S. BRODAL Bioinformtis Reserh Center, n Dept. of Computer Siene, University

More information

COMPUTING THE QUARTET DISTANCE BETWEEN EVOLUTIONARY TREES OF BOUNDED DEGREE

COMPUTING THE QUARTET DISTANCE BETWEEN EVOLUTIONARY TREES OF BOUNDED DEGREE COMPUTING THE QUARTET DISTANCE BETWEEN EVOLUTIONARY TREES OF BOUNDED DEGREE M. STISSING, C. N. S. PEDERSEN, T. MAILUND AND G. S. BRODAL Bioinformtis Reserh Center, n Dept. of Computer Siene, University

More information

CS 491G Combinatorial Optimization Lecture Notes

CS 491G Combinatorial Optimization Lecture Notes CS 491G Comintoril Optimiztion Leture Notes Dvi Owen July 30, August 1 1 Mthings Figure 1: two possile mthings in simple grph. Definition 1 Given grph G = V, E, mthing is olletion of eges M suh tht e i,

More information

22: Union Find. CS 473u - Algorithms - Spring April 14, We want to maintain a collection of sets, under the operations of:

22: Union Find. CS 473u - Algorithms - Spring April 14, We want to maintain a collection of sets, under the operations of: 22: Union Fin CS 473u - Algorithms - Spring 2005 April 14, 2005 1 Union-Fin We wnt to mintin olletion of sets, uner the opertions of: 1. MkeSet(x) - rete set tht ontins the single element x. 2. Fin(x)

More information

Counting Paths Between Vertices. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs

Counting Paths Between Vertices. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs Isomorphism of Grphs Definition The simple grphs G 1 = (V 1, E 1 ) n G = (V, E ) re isomorphi if there is ijetion (n oneto-one n onto funtion) f from V 1 to V with the property tht n re jent in G 1 if

More information

Solutions for HW9. Bipartite: put the red vertices in V 1 and the black in V 2. Not bipartite!

Solutions for HW9. Bipartite: put the red vertices in V 1 and the black in V 2. Not bipartite! Solutions for HW9 Exerise 28. () Drw C 6, W 6 K 6, n K 5,3. C 6 : W 6 : K 6 : K 5,3 : () Whih of the following re iprtite? Justify your nswer. Biprtite: put the re verties in V 1 n the lk in V 2. Biprtite:

More information

2.4 Theoretical Foundations

2.4 Theoretical Foundations 2 Progrmming Lnguge Syntx 2.4 Theoretil Fountions As note in the min text, snners n prsers re se on the finite utomt n pushown utomt tht form the ottom two levels of the Chomsky lnguge hierrhy. At eh level

More information

CSE 332. Sorting. Data Abstractions. CSE 332: Data Abstractions. QuickSort Cutoff 1. Where We Are 2. Bounding The MAXIMUM Problem 4

CSE 332. Sorting. Data Abstractions. CSE 332: Data Abstractions. QuickSort Cutoff 1. Where We Are 2. Bounding The MAXIMUM Problem 4 Am Blnk Leture 13 Winter 2016 CSE 332 CSE 332: Dt Astrtions Sorting Dt Astrtions QuikSort Cutoff 1 Where We Are 2 For smll n, the reursion is wste. The onstnts on quik/merge sort re higher thn the ones

More information

I 3 2 = I I 4 = 2A

I 3 2 = I I 4 = 2A ECE 210 Eletril Ciruit Anlysis University of llinois t Chigo 2.13 We re ske to use KCL to fin urrents 1 4. The key point in pplying KCL in this prolem is to strt with noe where only one of the urrents

More information

Lecture 6: Coding theory

Lecture 6: Coding theory Leture 6: Coing theory Biology 429 Crl Bergstrom Ferury 4, 2008 Soures: This leture loosely follows Cover n Thoms Chpter 5 n Yeung Chpter 3. As usul, some of the text n equtions re tken iretly from those

More information

Mid-Term Examination - Spring 2014 Mathematical Programming with Applications to Economics Total Score: 45; Time: 3 hours

Mid-Term Examination - Spring 2014 Mathematical Programming with Applications to Economics Total Score: 45; Time: 3 hours Mi-Term Exmintion - Spring 0 Mthemtil Progrmming with Applitions to Eonomis Totl Sore: 5; Time: hours. Let G = (N, E) e irete grph. Define the inegree of vertex i N s the numer of eges tht re oming into

More information

1 PYTHAGORAS THEOREM 1. Given a right angled triangle, the square of the hypotenuse is equal to the sum of the squares of the other two sides.

1 PYTHAGORAS THEOREM 1. Given a right angled triangle, the square of the hypotenuse is equal to the sum of the squares of the other two sides. 1 PYTHAGORAS THEOREM 1 1 Pythgors Theorem In this setion we will present geometri proof of the fmous theorem of Pythgors. Given right ngled tringle, the squre of the hypotenuse is equl to the sum of the

More information

Lecture 2: Cayley Graphs

Lecture 2: Cayley Graphs Mth 137B Professor: Pri Brtlett Leture 2: Cyley Grphs Week 3 UCSB 2014 (Relevnt soure mteril: Setion VIII.1 of Bollos s Moern Grph Theory; 3.7 of Gosil n Royle s Algeri Grph Theory; vrious ppers I ve re

More information

CS 2204 DIGITAL LOGIC & STATE MACHINE DESIGN SPRING 2014

CS 2204 DIGITAL LOGIC & STATE MACHINE DESIGN SPRING 2014 S 224 DIGITAL LOGI & STATE MAHINE DESIGN SPRING 214 DUE : Mrh 27, 214 HOMEWORK III READ : Relte portions of hpters VII n VIII ASSIGNMENT : There re three questions. Solve ll homework n exm prolems s shown

More information

Necessary and sucient conditions for some two. Abstract. Further we show that the necessary conditions for the existence of an OD(44 s 1 s 2 )

Necessary and sucient conditions for some two. Abstract. Further we show that the necessary conditions for the existence of an OD(44 s 1 s 2 ) Neessry n suient onitions for some two vrile orthogonl esigns in orer 44 C. Koukouvinos, M. Mitrouli y, n Jennifer Seerry z Deite to Professor Anne Penfol Street Astrt We give new lgorithm whih llows us

More information

Common intervals of genomes. Mathieu Raffinot CNRS LIAFA

Common intervals of genomes. Mathieu Raffinot CNRS LIAFA Common intervls of genomes Mthieu Rffinot CNRS LIF Context: omprtive genomis. set of genomes prtilly/totlly nnotte Informtive group of genes or omins? Ex: COG tse Mny iffiulties! iology Wht re two similr

More information

Monochromatic Plane Matchings in Bicolored Point Set

Monochromatic Plane Matchings in Bicolored Point Set CCCG 2017, Ottw, Ontrio, July 26 28, 2017 Monohromti Plne Mthings in Biolore Point Set A. Krim Au-Affsh Sujoy Bhore Pz Crmi Astrt Motivte y networks interply, we stuy the prolem of omputing monohromti

More information

Algorithms & Data Structures Homework 8 HS 18 Exercise Class (Room & TA): Submitted by: Peer Feedback by: Points:

Algorithms & Data Structures Homework 8 HS 18 Exercise Class (Room & TA): Submitted by: Peer Feedback by: Points: Eidgenössishe Tehnishe Hohshule Zürih Eole polytehnique fédérle de Zurih Politenio federle di Zurigo Federl Institute of Tehnology t Zurih Deprtement of Computer Siene. Novemer 0 Mrkus Püshel, Dvid Steurer

More information

CS 360 Exam 2 Fall 2014 Name

CS 360 Exam 2 Fall 2014 Name CS 360 Exm 2 Fll 2014 Nme 1. The lsses shown elow efine singly-linke list n stk. Write three ifferent O(n)-time versions of the reverse_print metho s speifie elow. Eh version of the metho shoul output

More information

CIT 596 Theory of Computation 1. Graphs and Digraphs

CIT 596 Theory of Computation 1. Graphs and Digraphs CIT 596 Theory of Computtion 1 A grph G = (V (G), E(G)) onsists of two finite sets: V (G), the vertex set of the grph, often enote y just V, whih is nonempty set of elements lle verties, n E(G), the ege

More information

18.06 Problem Set 4 Due Wednesday, Oct. 11, 2006 at 4:00 p.m. in 2-106

18.06 Problem Set 4 Due Wednesday, Oct. 11, 2006 at 4:00 p.m. in 2-106 8. Problem Set Due Wenesy, Ot., t : p.m. in - Problem Mony / Consier the eight vetors 5, 5, 5,..., () List ll of the one-element, linerly epenent sets forme from these. (b) Wht re the two-element, linerly

More information

A Lower Bound for the Length of a Partial Transversal in a Latin Square, Revised Version

A Lower Bound for the Length of a Partial Transversal in a Latin Square, Revised Version A Lower Bound for the Length of Prtil Trnsversl in Ltin Squre, Revised Version Pooy Htmi nd Peter W. Shor Deprtment of Mthemtil Sienes, Shrif University of Tehnology, P.O.Bo 11365-9415, Tehrn, Irn Deprtment

More information

Welcome. Balanced search trees. Balanced Search Trees. Inge Li Gørtz

Welcome. Balanced search trees. Balanced Search Trees. Inge Li Gørtz Welome nge Li Gørt. everse tehing n isussion of exerises: 02110 nge Li Gørt 3 tehing ssistnts 8.00-9.15 Group work 9.15-9.45 isussions of your solutions in lss 10.00-11.15 Leture 11.15-11.45 Work on exerises

More information

Factorising FACTORISING.

Factorising FACTORISING. Ftorising FACTORISING www.mthletis.om.u Ftorising FACTORISING Ftorising is the opposite of expning. It is the proess of putting expressions into rkets rther thn expning them out. In this setion you will

More information

On a Class of Planar Graphs with Straight-Line Grid Drawings on Linear Area

On a Class of Planar Graphs with Straight-Line Grid Drawings on Linear Area Journl of Grph Algorithms n Applitions http://jg.info/ vol. 13, no. 2, pp. 153 177 (2009) On Clss of Plnr Grphs with Stright-Line Gri Drwings on Liner Are M. Rezul Krim 1,2 M. Siur Rhmn 1 1 Deprtment of

More information

Numbers and indices. 1.1 Fractions. GCSE C Example 1. Handy hint. Key point

Numbers and indices. 1.1 Fractions. GCSE C Example 1. Handy hint. Key point GCSE C Emple 7 Work out 9 Give your nswer in its simplest form Numers n inies Reiprote mens invert or turn upsie own The reiprol of is 9 9 Mke sure you only invert the frtion you re iviing y 7 You multiply

More information

Compression of Palindromes and Regularity.

Compression of Palindromes and Regularity. Compression of Plinromes n Regulrity. Kyoko Shikishim-Tsuji Center for Lierl Arts Eution n Reserh Tenri University 1 Introution In [1], property of likstrem t t view of tse is isusse n it is shown tht

More information

The DOACROSS statement

The DOACROSS statement The DOACROSS sttement Is prllel loop similr to DOALL, ut it llows prouer-onsumer type of synhroniztion. Synhroniztion is llowe from lower to higher itertions sine it is ssume tht lower itertions re selete

More information

A Disambiguation Algorithm for Finite Automata and Functional Transducers

A Disambiguation Algorithm for Finite Automata and Functional Transducers A Dismigution Algorithm for Finite Automt n Funtionl Trnsuers Mehryr Mohri Cournt Institute of Mthemtil Sienes n Google Reserh 51 Merer Street, New York, NY 1001, USA Astrt. We present new ismigution lgorithm

More information

Lecture 4: Graph Theory and the Four-Color Theorem

Lecture 4: Graph Theory and the Four-Color Theorem CCS Disrete II Professor: Pri Brtlett Leture 4: Grph Theory n the Four-Color Theorem Week 4 UCSB 2015 Through the rest of this lss, we re going to refer frequently to things lle grphs! If you hen t seen

More information

Data Structures LECTURE 10. Huffman coding. Example. Coding: problem definition

Data Structures LECTURE 10. Huffman coding. Example. Coding: problem definition Dt Strutures, Spring 24 L. Joskowiz Dt Strutures LEURE Humn oing Motivtion Uniquel eipherle oes Prei oes Humn oe onstrution Etensions n pplitions hpter 6.3 pp 385 392 in tetook Motivtion Suppose we wnt

More information

arxiv: v1 [cs.dm] 24 Jul 2017

arxiv: v1 [cs.dm] 24 Jul 2017 Some lsses of grphs tht re not PCGs 1 rxiv:1707.07436v1 [s.dm] 24 Jul 2017 Pierluigi Biohi Angelo Monti Tizin Clmoneri Rossell Petreshi Computer Siene Deprtment, Spienz University of Rome, Itly pierluigi.iohi@gmil.om,

More information

p-adic Egyptian Fractions

p-adic Egyptian Fractions p-adic Egyptin Frctions Contents 1 Introduction 1 2 Trditionl Egyptin Frctions nd Greedy Algorithm 2 3 Set-up 3 4 p-greedy Algorithm 5 5 p-egyptin Trditionl 10 6 Conclusion 1 Introduction An Egyptin frction

More information

Subsequence Automata with Default Transitions

Subsequence Automata with Default Transitions Susequene Automt with Defult Trnsitions Philip Bille, Inge Li Gørtz, n Freerik Rye Skjoljensen Tehnil University of Denmrk {phi,inge,fskj}@tu.k Astrt. Let S e string of length n with hrters from n lphet

More information

Lecture 11 Binary Decision Diagrams (BDDs)

Lecture 11 Binary Decision Diagrams (BDDs) C 474A/57A Computer-Aie Logi Design Leture Binry Deision Digrms (BDDs) C 474/575 Susn Lyseky o 3 Boolen Logi untions Representtions untion n e represente in ierent wys ruth tle, eqution, K-mp, iruit, et

More information

Section 2.1 Special Right Triangles

Section 2.1 Special Right Triangles Se..1 Speil Rigt Tringles 49 Te --90 Tringle Setion.1 Speil Rigt Tringles Te --90 tringle (or just 0-60-90) is so nme euse of its ngle mesures. Te lengts of te sies, toug, ve very speifi pttern to tem

More information

Lecture Notes No. 10

Lecture Notes No. 10 2.6 System Identifition, Estimtion, nd Lerning Leture otes o. Mrh 3, 26 6 Model Struture of Liner ime Invrint Systems 6. Model Struture In representing dynmil system, the first step is to find n pproprite

More information

Project 6: Minigoals Towards Simplifying and Rewriting Expressions

Project 6: Minigoals Towards Simplifying and Rewriting Expressions MAT 51 Wldis Projet 6: Minigols Towrds Simplifying nd Rewriting Expressions The distriutive property nd like terms You hve proly lerned in previous lsses out dding like terms ut one prolem with the wy

More information

NON-DETERMINISTIC FSA

NON-DETERMINISTIC FSA Tw o types of non-determinism: NON-DETERMINISTIC FS () Multiple strt-sttes; strt-sttes S Q. The lnguge L(M) ={x:x tkes M from some strt-stte to some finl-stte nd ll of x is proessed}. The string x = is

More information

CS261: A Second Course in Algorithms Lecture #5: Minimum-Cost Bipartite Matching

CS261: A Second Course in Algorithms Lecture #5: Minimum-Cost Bipartite Matching CS261: A Seon Course in Algorithms Leture #5: Minimum-Cost Biprtite Mthing Tim Roughgren Jnury 19, 2016 1 Preliminries Figure 1: Exmple of iprtite grph. The eges {, } n {, } onstitute mthing. Lst leture

More information

Surds and Indices. Surds and Indices. Curriculum Ready ACMNA: 233,

Surds and Indices. Surds and Indices. Curriculum Ready ACMNA: 233, Surs n Inies Surs n Inies Curriulum Rey ACMNA:, 6 www.mthletis.om Surs SURDS & & Inies INDICES Inies n surs re very losely relte. A numer uner (squre root sign) is lle sur if the squre root n t e simplifie.

More information

Chapter 4 State-Space Planning

Chapter 4 State-Space Planning Leture slides for Automted Plnning: Theory nd Prtie Chpter 4 Stte-Spe Plnning Dn S. Nu CMSC 722, AI Plnning University of Mrylnd, Spring 2008 1 Motivtion Nerly ll plnning proedures re serh proedures Different

More information

Automata and Regular Languages

Automata and Regular Languages Chpter 9 Automt n Regulr Lnguges 9. Introution This hpter looks t mthemtil moels of omputtion n lnguges tht esrie them. The moel-lnguge reltionship hs multiple levels. We shll explore the simplest level,

More information

CARLETON UNIVERSITY. 1.0 Problems and Most Solutions, Sect B, 2005

CARLETON UNIVERSITY. 1.0 Problems and Most Solutions, Sect B, 2005 RLETON UNIVERSIT eprtment of Eletronis ELE 2607 Swithing iruits erury 28, 05; 0 pm.0 Prolems n Most Solutions, Set, 2005 Jn. 2, #8 n #0; Simplify, Prove Prolem. #8 Simplify + + + Reue to four letters (literls).

More information

Global alignment. Genome Rearrangements Finding preserved genes. Lecture 18

Global alignment. Genome Rearrangements Finding preserved genes. Lecture 18 Computt onl Biology Leture 18 Genome Rerrngements Finding preserved genes We hve seen before how to rerrnge genome to obtin nother one bsed on: Reversls Knowledge of preserved bloks (or genes) Now we re

More information

Discrete Structures Lecture 11

Discrete Structures Lecture 11 Introdution Good morning. In this setion we study funtions. A funtion is mpping from one set to nother set or, perhps, from one set to itself. We study the properties of funtions. A mpping my not e funtion.

More information

Particle Physics. Michaelmas Term 2011 Prof Mark Thomson. Handout 3 : Interaction by Particle Exchange and QED. Recap

Particle Physics. Michaelmas Term 2011 Prof Mark Thomson. Handout 3 : Interaction by Particle Exchange and QED. Recap Prtile Physis Mihelms Term 2011 Prof Mrk Thomson g X g X g g Hnout 3 : Intertion y Prtile Exhnge n QED Prof. M.A. Thomson Mihelms 2011 101 Rep Working towrs proper lultion of ey n sttering proesses lnitilly

More information

Now we must transform the original model so we can use the new parameters. = S max. Recruits

Now we must transform the original model so we can use the new parameters. = S max. Recruits MODEL FOR VARIABLE RECRUITMENT (ontinue) Alterntive Prmeteriztions of the pwner-reruit Moels We n write ny moel in numerous ifferent ut equivlent forms. Uner ertin irumstnes it is onvenient to work with

More information

Graph Algorithms. Vertex set = { a,b,c,d } Edge set = { {a,c}, {b,c}, {c,d}, {b,d}} Figure 1: An example for a simple graph

Graph Algorithms. Vertex set = { a,b,c,d } Edge set = { {a,c}, {b,c}, {c,d}, {b,d}} Figure 1: An example for a simple graph Inin Institute of Informtion Tehnology Design n Mnufturing, Knheepurm, Chenni 00, Ini An Autonomous Institute uner MHRD, Govt of Ini http://www.iiitm..in COM 0T Design n Anlysis of Algorithms -Leture Notes

More information

A Primer on Continuous-time Economic Dynamics

A Primer on Continuous-time Economic Dynamics Eonomis 205A Fll 2008 K Kletzer A Primer on Continuous-time Eonomi Dnmis A Liner Differentil Eqution Sstems (i) Simplest se We egin with the simple liner first-orer ifferentil eqution The generl solution

More information

Fast index for approximate string matching

Fast index for approximate string matching Fst index for pproximte string mthing Dekel Tsur Astrt We present n index tht stores text of length n suh tht given pttern of length m, ll the sustrings of the text tht re within Hmming distne (or edit

More information

Computational Biology Lecture 18: Genome rearrangements, finding maximal matches Saad Mneimneh

Computational Biology Lecture 18: Genome rearrangements, finding maximal matches Saad Mneimneh Computtionl Biology Leture 8: Genome rerrngements, finding miml mthes Sd Mneimneh We hve seen how to rerrnge genome to otin nother one sed on reversls nd the knowledge of the preserved loks or genes. Now

More information

Lecture 8: Abstract Algebra

Lecture 8: Abstract Algebra Mth 94 Professor: Pri Brtlett Leture 8: Astrt Alger Week 8 UCSB 2015 This is the eighth week of the Mthemtis Sujet Test GRE prep ourse; here, we run very rough-n-tumle review of strt lger! As lwys, this

More information

for all x in [a,b], then the area of the region bounded by the graphs of f and g and the vertical lines x = a and x = b is b [ ( ) ( )] A= f x g x dx

for all x in [a,b], then the area of the region bounded by the graphs of f and g and the vertical lines x = a and x = b is b [ ( ) ( )] A= f x g x dx Applitions of Integrtion Are of Region Between Two Curves Ojetive: Fin the re of region etween two urves using integrtion. Fin the re of region etween interseting urves using integrtion. Desrie integrtion

More information

arxiv: v2 [math.co] 31 Oct 2016

arxiv: v2 [math.co] 31 Oct 2016 On exlue minors of onnetivity 2 for the lss of frme mtrois rxiv:1502.06896v2 [mth.co] 31 Ot 2016 Mtt DeVos Dryl Funk Irene Pivotto Astrt We investigte the set of exlue minors of onnetivity 2 for the lss

More information

CS 573 Automata Theory and Formal Languages

CS 573 Automata Theory and Formal Languages Non-determinism Automt Theory nd Forml Lnguges Professor Leslie Lnder Leture # 3 Septemer 6, 2 To hieve our gol, we need the onept of Non-deterministi Finite Automton with -moves (NFA) An NFA is tuple

More information

Section 2.3. Matrix Inverses

Section 2.3. Matrix Inverses Mtri lger Mtri nverses Setion.. Mtri nverses hree si opertions on mtries, ition, multiplition, n sutrtion, re nlogues for mtries of the sme opertions for numers. n this setion we introue the mtri nlogue

More information

Computing all-terminal reliability of stochastic networks with Binary Decision Diagrams

Computing all-terminal reliability of stochastic networks with Binary Decision Diagrams Computing ll-terminl reliility of stohsti networks with Binry Deision Digrms Gry Hry 1, Corinne Luet 1, n Nikolos Limnios 2 1 LRIA, FRE 2733, 5 rue u Moulin Neuf 80000 AMIENS emil:(orinne.luet, gry.hry)@u-pirie.fr

More information

Connectivity in Graphs. CS311H: Discrete Mathematics. Graph Theory II. Example. Paths. Connectedness. Example

Connectivity in Graphs. CS311H: Discrete Mathematics. Graph Theory II. Example. Paths. Connectedness. Example Connetiit in Grphs CSH: Disrete Mthemtis Grph Theor II Instrtor: Işıl Dillig Tpil qestion: Is it possile to get from some noe to nother noe? Emple: Trin netork if there is pth from to, possile to tke trin

More information

Proving the Pythagorean Theorem

Proving the Pythagorean Theorem Proving the Pythgoren Theorem W. Bline Dowler June 30, 2010 Astrt Most people re fmilir with the formul 2 + 2 = 2. However, in most ses, this ws presented in lssroom s n solute with no ttempt t proof or

More information

I1 = I2 I1 = I2 + I3 I1 + I2 = I3 + I4 I 3

I1 = I2 I1 = I2 + I3 I1 + I2 = I3 + I4 I 3 2 The Prllel Circuit Electric Circuits: Figure 2- elow show ttery nd multiple resistors rrnged in prllel. Ech resistor receives portion of the current from the ttery sed on its resistnce. The split is

More information

Computing on rings by oblivious robots: a unified approach for different tasks

Computing on rings by oblivious robots: a unified approach for different tasks Computing on rings y olivious roots: unifie pproh for ifferent tsks Ginlorenzo D Angelo, Griele Di Stefno, Alfreo Nvrr, Niols Nisse, Krol Suhn To ite this version: Ginlorenzo D Angelo, Griele Di Stefno,

More information

Technische Universität München Winter term 2009/10 I7 Prof. J. Esparza / J. Křetínský / M. Luttenberger 11. Februar Solution

Technische Universität München Winter term 2009/10 I7 Prof. J. Esparza / J. Křetínský / M. Luttenberger 11. Februar Solution Tehnishe Universität Münhen Winter term 29/ I7 Prof. J. Esprz / J. Křetínský / M. Luttenerger. Ferur 2 Solution Automt nd Forml Lnguges Homework 2 Due 5..29. Exerise 2. Let A e the following finite utomton:

More information

6. Suppose lim = constant> 0. Which of the following does not hold?

6. Suppose lim = constant> 0. Which of the following does not hold? CSE 0-00 Nme Test 00 points UTA Stuent ID # Multiple Choie Write your nswer to the LEFT of eh prolem 5 points eh The k lrgest numers in file of n numers n e foun using Θ(k) memory in Θ(n lg k) time using

More information

Nondeterminism and Nodeterministic Automata

Nondeterminism and Nodeterministic Automata Nondeterminism nd Nodeterministic Automt 61 Nondeterminism nd Nondeterministic Automt The computtionl mchine models tht we lerned in the clss re deterministic in the sense tht the next move is uniquely

More information

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4 Intermedite Mth Circles Wednesdy, Novemer 14, 2018 Finite Automt II Nickols Rollick nrollick@uwterloo.c Regulr Lnguges Lst time, we were introduced to the ide of DFA (deterministic finite utomton), one

More information

The vertex leafage of chordal graphs

The vertex leafage of chordal graphs The vertex lefge of horl grphs Steven Chplik, Jurj Stho b Deprtment of Physis n Computer Siene, Wilfri Lurier University, 75 University Ave. West, Wterloo, Ontrio N2L 3C5, Cn b DIMAP n Mthemtis Institute,

More information

SOME INTEGRAL INEQUALITIES FOR HARMONICALLY CONVEX STOCHASTIC PROCESSES ON THE CO-ORDINATES

SOME INTEGRAL INEQUALITIES FOR HARMONICALLY CONVEX STOCHASTIC PROCESSES ON THE CO-ORDINATES Avne Mth Moels & Applitions Vol3 No 8 pp63-75 SOME INTEGRAL INEQUALITIES FOR HARMONICALLY CONVE STOCHASTIC PROCESSES ON THE CO-ORDINATES Nurgül Okur * Imt Işn Yusuf Ust 3 3 Giresun University Deprtment

More information

CS311 Computational Structures Regular Languages and Regular Grammars. Lecture 6

CS311 Computational Structures Regular Languages and Regular Grammars. Lecture 6 CS311 Computtionl Strutures Regulr Lnguges nd Regulr Grmmrs Leture 6 1 Wht we know so fr: RLs re losed under produt, union nd * Every RL n e written s RE, nd every RE represents RL Every RL n e reognized

More information

On the Spectra of Bipartite Directed Subgraphs of K 4

On the Spectra of Bipartite Directed Subgraphs of K 4 On the Spetr of Biprtite Direte Sugrphs of K 4 R. C. Bunge, 1 S. I. El-Znti, 1, H. J. Fry, 1 K. S. Kruss, 2 D. P. Roerts, 3 C. A. Sullivn, 4 A. A. Unsiker, 5 N. E. Witt 6 1 Illinois Stte University, Norml,

More information

On the existence of a cherry-picking sequence

On the existence of a cherry-picking sequence On the existene of herry-piking sequene Jnosh Döker, Simone Linz Deprtment of Computer Siene, University of Tüingen, Germny Deprtment of Computer Siene, University of Aukln, New Zeln Astrt Reently, the

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design nd Anlysis LECTURE 5 Supplement Greedy Algorithms Cont d Minimizing lteness Ching (NOT overed in leture) Adm Smith 9/8/10 A. Smith; sed on slides y E. Demine, C. Leiserson, S. Rskhodnikov,

More information

CSC2542 State-Space Planning

CSC2542 State-Space Planning CSC2542 Stte-Spe Plnning Sheil MIlrith Deprtment of Computer Siene University of Toronto Fll 2010 1 Aknowlegements Some the slies use in this ourse re moifitions of Dn Nu s leture slies for the textook

More information

Introduction to Olympiad Inequalities

Introduction to Olympiad Inequalities Introdution to Olympid Inequlities Edutionl Studies Progrm HSSP Msshusetts Institute of Tehnology Snj Simonovikj Spring 207 Contents Wrm up nd Am-Gm inequlity 2. Elementry inequlities......................

More information

XML and Databases. Exam Preperation Discuss Answers to last year s exam. Sebastian Maneth NICTA and UNSW

XML and Databases. Exam Preperation Discuss Answers to last year s exam. Sebastian Maneth NICTA and UNSW XML n Dtses Exm Prepertion Disuss Answers to lst yer s exm Sestin Mneth NICTA n UNSW CSE@UNSW -- Semester 1, 2008 (1) For eh of the following, explin why it is not well-forme XML (is WFC or the XML grmmr

More information

Maximum size of a minimum watching system and the graphs achieving the bound

Maximum size of a minimum watching system and the graphs achieving the bound Mximum size of minimum wthing system n the grphs hieving the oun Tille mximum un système e ontrôle minimum et les grphes tteignnt l orne Dvi Auger Irène Chron Olivier Hury Antoine Lostein 00D0 Mrs 00 Déprtement

More information

Convert the NFA into DFA

Convert the NFA into DFA Convert the NF into F For ech NF we cn find F ccepting the sme lnguge. The numer of sttes of the F could e exponentil in the numer of sttes of the NF, ut in prctice this worst cse occurs rrely. lgorithm:

More information

Solutions to Problem Set #1

Solutions to Problem Set #1 CSE 233 Spring, 2016 Solutions to Prolem Set #1 1. The movie tse onsists of the following two reltions movie: title, iretor, tor sheule: theter, title The first reltion provies titles, iretors, n tors

More information

Total score: /100 points

Total score: /100 points Points misse: Stuent's Nme: Totl sore: /100 points Est Tennessee Stte University Deprtment of Computer n Informtion Sienes CSCI 2710 (Trnoff) Disrete Strutures TEST 2 for Fll Semester, 2004 Re this efore

More information

Arrow s Impossibility Theorem

Arrow s Impossibility Theorem Rep Voting Prdoxes Properties Arrow s Theorem Arrow s Impossiility Theorem Leture 12 Arrow s Impossiility Theorem Leture 12, Slide 1 Rep Voting Prdoxes Properties Arrow s Theorem Leture Overview 1 Rep

More information

Graph Theory. Simple Graph G = (V, E). V={a,b,c,d,e,f,g,h,k} E={(a,b),(a,g),( a,h),(a,k),(b,c),(b,k),...,(h,k)}

Graph Theory. Simple Graph G = (V, E). V={a,b,c,d,e,f,g,h,k} E={(a,b),(a,g),( a,h),(a,k),(b,c),(b,k),...,(h,k)} Grph Theory Simple Grph G = (V, E). V ={verties}, E={eges}. h k g f e V={,,,,e,f,g,h,k} E={(,),(,g),(,h),(,k),(,),(,k),...,(h,k)} E =16. 1 Grph or Multi-Grph We llow loops n multiple eges. G = (V, E.ψ)

More information

Matrices SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics (c) 1. Definition of a Matrix

Matrices SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics (c) 1. Definition of a Matrix tries Definition of tri mtri is regulr rry of numers enlosed inside rkets SCHOOL OF ENGINEERING & UIL ENVIRONEN Emple he following re ll mtries: ), ) 9, themtis ), d) tries Definition of tri Size of tri

More information

MCH T 111 Handout Triangle Review Page 1 of 3

MCH T 111 Handout Triangle Review Page 1 of 3 Hnout Tringle Review Pge of 3 In the stuy of sttis, it is importnt tht you e le to solve lgeri equtions n tringle prolems using trigonometry. The following is review of trigonometry sis. Right Tringle:

More information

Finite State Automata and Determinisation

Finite State Automata and Determinisation Finite Stte Automt nd Deterministion Tim Dworn Jnury, 2016 Lnguges fs nf re df Deterministion 2 Outline 1 Lnguges 2 Finite Stte Automt (fs) 3 Non-deterministi Finite Stte Automt (nf) 4 Regulr Expressions

More information

A Short Introduction to Self-similar Groups

A Short Introduction to Self-similar Groups A Short Introution to Self-similr Groups Murry Eler* Asi Pifi Mthemtis Newsletter Astrt. Self-similr groups re fsinting re of urrent reserh. Here we give short, n hopefully essile, introution to them.

More information

Lesson 2: The Pythagorean Theorem and Similar Triangles. A Brief Review of the Pythagorean Theorem.

Lesson 2: The Pythagorean Theorem and Similar Triangles. A Brief Review of the Pythagorean Theorem. 27 Lesson 2: The Pythgoren Theorem nd Similr Tringles A Brief Review of the Pythgoren Theorem. Rell tht n ngle whih mesures 90º is lled right ngle. If one of the ngles of tringle is right ngle, then we

More information

On-Line Construction of Compact Directed Acyclic Word Graphs

On-Line Construction of Compact Directed Acyclic Word Graphs On-Line Constrution of Compt Direte Ayli Wor Grphs Shunsuke neng, Hiroms Hoshino, Ayumi Shinohr, Msyuki Tke,SetsuoArikw, Ginrlo Muri 2, n Giulio Pvesi 2 Dept. of nformtis, Kyushu University, Jpn {s-ine,hoshino,yumi,tke,rikw}@i.kyushu-u..jp

More information

Part 4. Integration (with Proofs)

Part 4. Integration (with Proofs) Prt 4. Integrtion (with Proofs) 4.1 Definition Definition A prtition P of [, b] is finite set of points {x 0, x 1,..., x n } with = x 0 < x 1

More information

6.5 Improper integrals

6.5 Improper integrals Eerpt from "Clulus" 3 AoPS In. www.rtofprolemsolving.om 6.5. IMPROPER INTEGRALS 6.5 Improper integrls As we ve seen, we use the definite integrl R f to ompute the re of the region under the grph of y =

More information

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministi Finite utomt The Power of Guessing Tuesdy, Otoer 4, 2 Reding: Sipser.2 (first prt); Stoughton 3.3 3.5 S235 Lnguges nd utomt eprtment of omputer Siene Wellesley ollege Finite utomton (F)

More information

System Validation (IN4387) November 2, 2012, 14:00-17:00

System Validation (IN4387) November 2, 2012, 14:00-17:00 System Vlidtion (IN4387) Novemer 2, 2012, 14:00-17:00 Importnt Notes. The exmintion omprises 5 question in 4 pges. Give omplete explntion nd do not onfine yourself to giving the finl nswer. Good luk! Exerise

More information

GRUPOS NANTEL BERGERON

GRUPOS NANTEL BERGERON Drft of Septemer 8, 2017 GRUPOS NANTEL BERGERON Astrt. 1. Quik Introution In this mini ourse we will see how to ount severl ttriute relte to symmetries of n ojet. For exmple, how mny ifferent ies with

More information

Nondeterministic Automata vs Deterministic Automata

Nondeterministic Automata vs Deterministic Automata Nondeterministi Automt vs Deterministi Automt We lerned tht NFA is onvenient model for showing the reltionships mong regulr grmmrs, FA, nd regulr expressions, nd designing them. However, we know tht n

More information

Arrow s Impossibility Theorem

Arrow s Impossibility Theorem Rep Fun Gme Properties Arrow s Theorem Arrow s Impossiility Theorem Leture 12 Arrow s Impossiility Theorem Leture 12, Slide 1 Rep Fun Gme Properties Arrow s Theorem Leture Overview 1 Rep 2 Fun Gme 3 Properties

More information

Section 1.3 Triangles

Section 1.3 Triangles Se 1.3 Tringles 21 Setion 1.3 Tringles LELING TRINGLE The line segments tht form tringle re lled the sides of the tringle. Eh pir of sides forms n ngle, lled n interior ngle, nd eh tringle hs three interior

More information

Phylogenies via Quartets

Phylogenies via Quartets Phylogenies vi Qurtets Dvi Brynt rynt@mth.mgill. LIRMM, Frne CRM, U. e M. U. Cnterury MGill University Bite-size trees There is only one unroote tree for one, two or three tx... But there re four unroote

More information

EXTENSION OF THE GCD STAR OF DAVID THEOREM TO MORE THAN TWO GCDS CALVIN LONG AND EDWARD KORNTVED

EXTENSION OF THE GCD STAR OF DAVID THEOREM TO MORE THAN TWO GCDS CALVIN LONG AND EDWARD KORNTVED EXTENSION OF THE GCD STAR OF DAVID THEOREM TO MORE THAN TWO GCDS CALVIN LONG AND EDWARD KORNTVED Astrt. The GCD Str of Dvi Theorem n the numerous ppers relte to it hve lrgel een evote to shoing the equlit

More information

Lecture 3. XML Into RDBMS. XML and Databases. Memory Representations. Memory Representations. Traversals and Pre/Post-Encoding. Memory Representations

Lecture 3. XML Into RDBMS. XML and Databases. Memory Representations. Memory Representations. Traversals and Pre/Post-Encoding. Memory Representations Leture XML into RDBMS XML n Dtses Sestin Mneth NICTA n UNSW Leture XML Into RDBMS CSE@UNSW -- Semester, 00 Memory Representtions Memory Representtions Fts DOM is esy to use, ut memory hevy. in-memory size

More information

Hyers-Ulam stability of Pielou logistic difference equation

Hyers-Ulam stability of Pielou logistic difference equation vilble online t wwwisr-publitionsom/jns J Nonliner Si ppl, 0 (207, 35 322 Reserh rtile Journl Homepge: wwwtjnsom - wwwisr-publitionsom/jns Hyers-Ulm stbility of Pielou logisti differene eqution Soon-Mo

More information

Aperiodic tilings and substitutions

Aperiodic tilings and substitutions Aperioi tilings n sustitutions Niols Ollinger LIFO, Université Orléns Journées SDA2, Amiens June 12th, 2013 The Domino Prolem (DP) Assume we re given finite set of squre pltes of the sme size with eges

More information