On-Line Construction of Compact Directed Acyclic Word Graphs

Size: px
Start display at page:

Download "On-Line Construction of Compact Directed Acyclic Word Graphs"

Transcription

1 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 2 Dept. of Computer Siene, Systems n Communition University of Miln Bio, tly {muri,pvesi}@iso.unimi.it Astrt. A Compt Direte Ayli Wor Grph (CDAWG) is spe effiient text inexing struture, tht n e use in severl ifferent string lgorithms, espeilly in the nlysis of iologil sequenes. n this pper, we present new on line lgorithm for its onstrution, s well s the onstrution of CDAWG for set of strings. ntroution Severl ifferent string prolems, like those eriving from the nlysis of iologil sequenes, n e solve effiiently with suitle text inexing struture. Perhps, the most wiely use n known struture of this kin is the suffix tree, tht n e uilt in liner time n permits to effiiently fin n lote ll the sustrings of given string. The min rwk of suffix trees is the itionl spe require to implement the struture. n mny pplitions, like sequene nlysis n pttern isovery in iologil sequenes, keeping s mny t s possile in min memory might provie signifint vntges. This ft hs le to the introution of more spe effiient strutures, like suffix rrys [], suffix ti [2], n others. n this work, we fous our ttention on the Compt Direte Ayli Wor Grph (CDAWG), first esrie in [3]. The CDAWG for string n e seen either s omption of the Direte Ayli Wor Grph (DAWG) [4], or minimiztion of the suffix tree, from whih it n e erive s shown in [3,5] for DAWGs n [6] for suffix trees. n the ltter se, the si ie is to merge reunnt prts of the suffix tree (see ig. ). Experimentl results [3,5] hve shown how CDAWGs provie signifint reutions of the memory spe require y suffix trees n DAWGs when pplie to genomi sequenes. A liner time lgorithm for the iret onstrution of the CDAWG of string is presente in [5], so to voi the itionl spe require y the preliminry onstrution of The results esrie in this work were rehe inepenently y the Kyushu n Miln groups, sumitte simultneously to the onferene, n merge into joint ontriution. A. Amir n G.M. Lnu (Es.): CPM 200, LNCS 2089, pp , 200. Springer-Verlg Berlin Heielerg 200

2 70 Shunsuke neng et l. o o o o o o o ig.. Suffix tree n CDAWG for string oo. Sustrings o n o our s prefix of the sme suffixes: the orresponing noes re merge s well s the sutrees roote t the noes. Leves re merge into single finl noe. the DAWG or the suffix tree. The lgorithm is similr to MCreight s lgorithm for suffix trees [7]. n this pper, we present new lgorithm for the onstrution of CDAWGs, se on Ukkonen s lgorithm for suffix trees [8]. The lgorithm is on line, tht is, it proesses the hrters of the string from left to right one y one, with no nee to know the whole string eforehn. urthermore, we show how the lgorithm n e use to uil CDAWG for set of strings, struture first esrie in [3], where ws erive y ompting DAWG for set of strings. The min rwk of this pproh ws the ft tht, when new string ws e to the set, the DAWG h to e uilt gin from srth. nste, the lgorithm we present llows to new string iretly to the ompt struture. 2 Definitions Let Σ e nonempty finite lphet, n Σ the set of strings over Σ. f s = αβγ, withα, β, γ Σ,thenα is prefix of s, γ is suffix of s, n α, β, nγ re sustrings (ftors) of s. fs = s...s n is string in Σ, s enotes its length, n s[i..j] its sustring s i...s j.withsuf (s) we will enote the set of ll suffixes of s. LetX e suset of Σ. or ny string u Σ, u X = {x ux X}. Given string s, we efine the syntti ongruene on Σ ssoite with Suf (s) n enote y Suf (s) s: u Suf (s) v u Suf (s) =v Suf (s) (for ny u, v Σ ) Tht is, u n v our s prefixes of the sme suffixes of s. notherwors, the ourrenes of u n v must en t the sme positions in the string. Hene, if u n v our in the string, one must e suffix of the other. As in [3,5], we will ll lsses of ftors the ongruene lsses of the reltion Suf (s).the lss of ll strings tht re not sustrings of s is lle the egenerte lss. The

3 On-Line Constrution of Compt Direte Ayli Wor Grphs 7 ig. 2. mpliit CDAWG n CDAWG for string. longest string in non egenerte lss of ftors is the representtive of the lss. Given non egenerte lss of ftors C of Suf (s), n its representtive u, if there re t lest two hrters, Σ suh tht u n u re sustrings of s, thenc is strit lss of ftors of Suf (s).romnowon,wewillsytht two sustrings re stritly ongruent if they elong to the sme strit lss of ftors. We re now rey to give forml efinition of CDAWG. Definition. The ompt irete yli wor grph (CDAWG) of string s is irete yli grph, where:. two istint noes re mrke s initil n finl; 2. eges re lele with non empty sustrings of s; 3. lels of two eges leving the sme noe nnot egin with the sme hrter; 4. every suffix of s orrespons to pth on the grph strting from the initil noe n ening t noe, suh tht the ontention of the ege lels on the pth extly spells the suffix. rom now on, we will ll noe orresponing to suffix of s terminl noe; 5. sustrings spelle y pths strting from the initil noe n ening t the sme non terminl noe of the grph elong to the sme strit lss of ftors. The CDAWG of string s hs t most s + noes n 2 s 2 eges [3,5]. Aoring to the efinition of strit lss of ftors, non terminl noes must hve t lest two outgoing eges. We will enote with (p, α, q) theegep q of the grph lele with sustring α. The following efinitions will e useful throughout the pper: Definition 2. The impliit CDAWG of string s is CDAWG where noes with outegree one re remove, n eh ege entering noe with outegree one is merge with the ege leving it. n the impliit CDAWG of string s, thesuffixesofs re spelle out y pths in the grph strting t the initil noe, ut not neessrily ening t noe. An exmple is shown in ig. 2. or every noe p, letlength s (p) e the length of the longest sustring spelle y pth from the initil noe to p. Eges elonging

4 72 Shunsuke neng et l. to the spnning tree of the longest pths from the initil noe re lle soli eges. n other wors, n ege (p, α, q) is soli iff length s (q) =length s (p)+ α. inlly, we ssume tht the lel of eh ege is implemente with pir of integers enoting the strting n ening points in the string of the sustring orresponing to the lel, n every noe is nnotte with the length of the longest pth from the initil noe. 3 Constrution of the CDAWG for Single String GivennlphetΣ, lets = s...s n e string on Σ. Our lgorithm is ivie in n phses, uiling t eh phse i the impliit CDAWG G i for eh prefix s[..i] ofs. More in etil, the impliit CDAWG G i+ for s[..i +] is onstrute strting from grph G i for s[..i]. Eh phse i + is ivie in i + extensions, one for eh of the i + suffixes of s[..i + ]. n extension j of phse i +, the lgorithm fins the en of the pth from the initil noe lele with sustring s[j..i], n extens it y ing hrter s i+ to the pth, unless it is lrey there. Therefore, in phse i +, sustring s[..i + ] is first put on the grph, followe y s[2..i +],s[3..i + ], n so on. Extension i + of phse i + s the single hrter s i+ fter the initil noe. The initil grph G hs one initil noe n one finl noe, onnete y n ege lele y hrter s. The lgorithm n e skethe s follows:. Construt grph G 2. or i from to n o 3. or j from to i + o 4. in the en of the pth from lele s[j..i] 5. A hrter s i+ if neee 6. En for 7. En for At extension j of phse i +, one the en of the pth spelling s[j..i] hs een lote, the CDAWG n e upte oring to three ifferent rules:. n the urrent grph, the pth spelling s[j..i] ens in. To upte the grph, hrter s i+ is ppene to the lel of the ege entering. 2. The pth orresponing to s[j..i] oesnotontinuewiths i+, ut ontinues with t lest one hrter. f the pth ens t noe p, weretenew ege (p, s i+,). Otherwise, we rete new noe q t the en of the pth, splitting the ege in two t the point where the pth ens. Then, we rete new ege (q, s i+,). 3. Some pth t the en of s[j..i] ontinues with s i+. n this se, sustring s[j..i + ] is lrey in the urrent grph: we o nothing (hene the impliit grph). These rules, however, o not gurntee tht t the en of the phse we orretly onstrute CDAWG. n ft, the lgorithm must lso hek whether sustring stritly ongruent to nother one hs een enountere, or, onversely,

5 On-Line Constrution of Compt Direte Ayli Wor Grphs 73 ig. 3. mpliit CDAWG for string efore (left) n fter reiretion of n ege, t phse 6, extension 5. Noe, lele, ws rete t the previous extension, fter the insertion of t the en of the pth lele. Now,pth orresponing to is foun ening in the mile of non soli ege (,, ), tht is reirete to noe n eomes (,,). whether sustring hs to e remove from strit lss of ftors, so tht t the en of phse i+ pths ening t the sme noe orrespon to strit lsses of ftors of s[..i+], n vie vers. Here we sketh how the lgorithm hs to e moifie. A more etile esription of the lgorithm n its implementtion n e foun in [9]. Deteting Stritly Congruent tors. Two sustrings α n β elong to the sme lss C iff they re prefixes of the sme suffixes, n there re t lest two hrters, Σ suh tht α, α, β, nβ our in s. Moreover, α must e suffix of β, or vie vers. We suppose w.l.o.g. tht α = β, with Σ. We lso ssume tht α n β hve ourre just one, tht sustrings α n β hve een put in the grph in some previous phse (in two onseutive extensions), n in the urrent extension we hve to insert α. The pth spelling α ens in the mile of n ege, n the next hrter on the ege is. Anew noe p is rete t the en of the pth, s well s new ege (p,, ). At the following extension, we hve to lote β in the grph. f β hs ourre only one (together with α), it now elongs to the sme strit lss of ftors, n we en in the mile of non soli ege tht ontinues with. nthisse,wereiret theegetop, leling it with the prt of the lel tht ws ontine in the pth of β (see ig. 3). Sine there n e more thn two onseutive sustrings to e ssigne to the sme lss, it is possile tht we gin en long non soli eges in the following extensions. n this se, we reiret the non soli eges to p s well, until we reh n extension where we en t noe or long soli ege. Otherwise, if β h previously ourre lso y itself, either the pth orresponing to β ens t noe (β hs een followe y hrters ifferent from ), or the ege we en on is soli (β h een followe only y ). n the former se, if there is not n ege lele leving the noe we rete new

6 74 Shunsuke neng et l. 2 ig. 4. CDAWG for string t phse 7, extension 7. Chrter is foun t the en of the non soli ege (,,). At extension 6, the pth spelling ene t the finl noe. Thus, hs to e remove from the lss ssoite with noe, tht is lone into noe 2. Ege (,,) eomes (,,2). ege lele to the finl noe. n the ltter se, we rete new noe n onnet it to the finl noe with n ege lele. Then, there my e gin non soli eges tht hve to e reirete into the newly rete noe. Splitting Strit Clss of tors. Conversely, sustring tht hs een ssigne to strit lss of ftors hs to e remove from the lss if it oes not our s suffix of the representtive when new hrter s i+ is e to the string. Let α n β, α = β, e the two sustrings ssigne to the sme lss in the previous exmple. Now, suppose tht in phse i + we hve to insert β in the grph. n this se, s i+ is the lst hrter of β, n we fin it t the en of the ege entering noe p, tht is non soli, sine β is not the representtive of the lss. Now we hve two ses: s i+ ws foun t the en of n ege tht entere noe p lso t the previous extension, or we ene up somewhere else. n the former se, we h lso inserte α t the previous extension of the sme phse, therefore β still elongs to the sme lss. n the ltter, we hve etete n ourrene of β not preee y α, tht is, not s suffix of α, n we hve to remove it from the lss. To reflet this in the grph, we lone the noe p into new noe q, n reiret the non soli ege to q keeping the sme lel. The reirete ege eomes soli. An exmple is shown in ig. 4. f lso some suffixes of β h een previously ssigne to the sme lss s β, in the following extensions we will gin fin s i+ t the en of non soli ege entering p.these eges re reirete to q. t n e prove tht it suffies to hek only the lst ege on eh pth to ensure tht lss hs to e split. No loning tkes ple if hrter is foun t the en of n ege entering the finl noe. The two oservtions outline ove n e implemente in the lgorithm y moifying Rules 2 n 3 oringly. t is worth mentioning tht oth reiretion of eges to newly rete noe n noe loning n tke ple uring the sme phse. An exmple is shown in ig. 5.

7 On-Line Constrution of Compt Direte Ayli Wor Grphs 75 2 ig. 5. rom left to right, CDAWG for string t phse 6, extensions 5, 6, n 7. Chrter is put in the grph fter sustring, n the pth spelling is foun in the mile on non soli ege (,, ) (left) tht is reirete to noe (enter). Then, t extension 7 (tht s fter the empty string) is foun t the en of non soli ege. Noe is thus lone into noe 2 (right). 3. Using Suffix Links Nively, loting the en of s[j..i] inextensionj of phse i+ woul tke O(i j) time y wlking from the initil noe n mthing the hrters of s[j..i] long the eges of the grph. This woul le to n overll O(n 3 ) time omplexity for the onstrution of the whole grph. We will now reue it, s in [8], to O(n) y introuing suffix links n with some remrks. Definition 3. Let p e noe of the grph, ifferent from the initil or finl noe. Let β e the representtive of the lss ssoite with p. Thesuffix link of p, enote y L(p), is the noe q whose representtive γ is the longest suffix of β whose pth oes not en t p. The suffix link of noe p n e implemente with pointer from p to L(p). f γ is empty, then L(p) is the initil noe. Suffix links re not efine for the initil n the finl noe. Although the efinition oes not gurntee tht every noe in the grph hs suffix link, we n prove the following: Lemm. Any noe rete uring phse i + will hve suffix link from it y the en of the phse. Proof. n extension j of phse i + new noe p n e rete t the en of the pth spelling sustring s[j..i] y pplition of Rule 2 or y loning. n the former se, L(p) will e the first noe to e rete or enountere t the en of the pth orresponing to suffix of s[j..i] (possily fter ege reiretions). Suh noe lwys exists, sine the lst extension lotes the empty suffix t the initil noe. n the ltter se, let us suppose tht noe q is lone into noe p with pth spelling s[j..i + ]. Sustring s[j..i + ] is the longest suffix of the representtive of q tht oes not elong to the sme lss. Thus, L(q) isset to p. Suffix link L(p) is left unefine until one of the suffixes of s[j..i + ] ens t noe other thn p (tht gin oul e ).

8 76 Shunsuke neng et l. αβ p γ L(p) β q γ ig. 6. A suffix link. Noe p orrespons to lss αβ, noeq orrespons to β. Pths lele with suffixes of αβ longer thn β en t p. f t some extension j hrter s i+ is e fter αβγ, thenextensionsfromj + to j + α re impliitly performe s well. During ny phse, the only noe of the grph other thn the initil n the finl without suffix link from it is the lst rete one. Let us suppose tht the lgorithm hs omplete extension j of phse i +. Suffix links re use to spee up the serh for the remining suffixes of s[j..i]. Strting from the en of s[j..i] in the grph, we wlk kwrs long the pth orresponing to s[j..i] up to either the initil noe or noe p tht hs suffix link. This requires trversing t most one ege. Let γ e the ontention of the ege lels of the pth from p to s[j..i]. f p is not the initil noe, we move to noe L(p) n follow from it the pth spelling γ. Otherwise,weserhfors[j +..i] strting from. inlly we s i+ oring to one of the extension rules, reireting n ege or loning noe if neee. Notie tht, if noe p is the en of l 2 ifferent pths, the position rehe fter serhing from γ from L(p) will e the en of pth s[j + l..i], tht is, extensions from j +to j + l hve een impliitly performe t extension j. A pth spelling γ strting from L(p) lwys exists, sine ll the suffixes of s[j..i] re lrey in the grph. Thus, to fin the pth spelling γ the lgorithm just mthes the first hrters on the eges enountere. To otin liner time lgorithm, we nee just two more triks. Remrk. When uring ny extension Rule 3 is pplie, tht is, given sustring s[j..i + ] is lrey on the grph, then the sme rule will pply to ll further extensions, sine ll the suffixes of s[j..i + ] re lrey in the grph s well. Therefore, one Rule 3 is pplie (n no noe hs to e lone or eges reirete), we n stop n move on to the next phse, sine ll the strings to e inserte re lrey in the grph n no justment is neee for the lsses. Remrk 2. f new ege is rete entering the finl noe uring extension j of ny phse i, then Rule will lwys pply t extension j in ny suessive phse. Tht is, new hrters will lwys e ppene t the en of the lst ege in the pth ssoite with s[j..i], tht will enter the finl noe. Thus, when new ege is rete entering the finl noe with lel s[j..i + ], we lel it with integers h n e (j h i+), where e enotes the urrent phse, tht is,

9 On-Line Constrution of Compt Direte Ayli Wor Grphs 77 the urrent en position in the string. f we implement e with glol vrile, n set it to i + t the eginning of eh phse i +, we perform impliitly ll the extensions tht woul en up t the finl noe. Every phse i strts with series of pplitions of Rules n 2, tht put s i t the en of n ege entering the finl noe; when Rule 3 is pplie for the first time, it will e lso pplie to ll further extensions. Now, let j i e the first extension where Rule 3 is pplie with loning in phse i, nji the first extension where it is pplie without ege reiretion to the lone noe. Extensions j i + to ji will reiret eges to the lst noe rete. Extensions from ji +to i nee not to e performe, sine in eh of them we woul not o nything. n phse i +, ll extensions from to j i will pply Rule, therefore they re impliitly performe y setting the ounter e to i +.Thus, we n strt phse i+ iretly from extension ji, until we fin n extension where Rule 3 is pplie without loning or ege reiretion. This n e one y strting phse i+ from the position in the grph of the lst suffix of s[..i] tht h to e reirete to the lone noe. This took ple t extension ji. The first extension in phse i + will hve to look for s i+ extly t the enpoint of the lst extension of phse i. This will lso impliitly perform ll extensions from j i to ji. Of ourse, if in phse i Rule 3 is first pplie without loning wenmoveontophsei + s well. The lgorithm oes not nee to know whih extension is urrently performing. Tht is, it strts phse i + from the enpoint of phse i, ing s i+. Then it strts moving in the grph y using suffix links, n ing s i+ t the en of eh pth. f the kwr wlk ens t, nγ = γ...γ k is the lel of the pth trverse, then it looks for the pth lele γ 2...γ k.phsei + ens when the lgorithm pplies for the first time Rule 3 without noe loning or ege reiretion. Moreover, whenever we fin s i+ t the en of non soli ege, we no longer hve to hek wht hppene t the previous extension, n just lone the noe. n ft, if the representtive of the lss h een met uring one of the previous extensions, we woul hve stoppe the phse t tht point, without rehing the urrent extension. At the en of phse n, we hve onstrute the impliit CDAWG for string s. n orer to otin the tul CDAWG, we perform n itionl extension phse n +, extening the string to ummy symol $ tht oes not elong to the string lphet. Anywy, we o not inrement the phse ounter e to n +, so to voi ppening $ to eges entering the finl noe. Moreover, whenever new noe p hs to e rete, we o not the ege (p, $,) to the grph. Noes rete in this phse will thus hve outegree one, n will orrespon to terminl noes of the CDAWG. Notie tht, whenever pth s[j..n] ens long n ege, we lwys rete new noe n mrk it s terminl, while loning of noes n reiretion of eges work s in the previous phses. When pth s[j..n] ens t noe, we mrk the noe s terminl. At the en of the itionl phse, the impliit CDAWG hs een trnsforme into the tul CDAWG for string s. An exmple of the on line onstrution of CDAWG is shown in ig. 7.

10 78 Shunsuke neng et l. 2 2 ig. 7. rom left to right, onstrution of the CDAWG for string : t the en of phse 6 (impliit CDAWG for string ); t the en of phse 7 (, where,, n elong to the sme strit lss of ftors); t the en of phse 8 (, where n hve een remove from the lss with representtive ); the finl struture. Strs inite the position in the grph rehe t the en of the lst expliit extension of eh phse. With rguments nlogous to Ukkonen s lgorithm for suffix trees, we n prove the following: Theorem. Given string s = s...s n over finite lphet Σ, the lgorithm implemente with suffix links n impliit extensions uils the CDAWG for s in O(n) time n O(n Σ ) spe if the grph is implemente with trnsition mtrix, or in O(n Σ ) time n O(n) spe with jeny lists. Proof (Sketh). The opertions performe in ny expliit extension (retion or loning of noes, ege reiretions), tht is, extensions tht re not performe impliitly y inrementing the e ounter, tke onstnt time. Let ji the lst expliit extension performe t phse i, nj i+ the first expliit extension performe t phse i +. n the worst se, we hve j i+ = ji. Moreover, for eh i, j i j i+. Thus, t most 3n expliit extensions re performe y the lgorithm. At ny extension j of phse i, to lote the enpoint of s[j..i] the lgorithm wlks k t most one ege from the enpoint of s[j..i], follows suffix link, n then trverses some eges heking the first symol on eh ege. f the grph is implemente with trnsition mtrix, trversing n ege tkes onstnt time. Else, it tkes O( Σ ) time. The only thing unounte for is the overll numer of eges trverse. or every noe p of the grph, let the noe epth of p e the numer of noes on the pth from the root to p lele with the representtive of the lss ssoite with p. As in [8], the sum of the noe epths ounte uring ll the expliit extensions is reue t most y O(n), n sine the mximum noe epth is n, the mximum numer of eges trverse is oune y O(n).

11 On-Line Constrution of Compt Direte Ayli Wor Grphs 79 4 The CDAWG for Set of Strings The si ie of the CDAWG for set of strings S = {s,...,s k } is the sme of the single string struture. Now, the noes of the struture orrespon to ptterns tht our s prefix of the sme suffixes in every string of the set. n other wors, given Suf (S) (the set of the suffixes of the k strings), the noes of the CDAWG orrespon to strit lsses of ftors for Suf (S).Theonly ifferene is tht now we hve k finl noes... k, one for eh string, n we wnt ll the suffixes of s i to en t the orresponing finl noe i. This result n e otine y ppening ifferent termintion symol, not elonging to the string lphet, to eh string of the set. More formlly: Definition 4. The CDAWG for set of strings s...s k is irete yli grph, with noe mrke s initil n k istint noes... k mrke s finl. Eges re lele with non empty sustrings of t lest one of the strings. Lels of two eges leving the sme noe nnot egin with the sme hrter. or every string s i in the set, ll suffixes of s i re spelle y ptterns strting t the initil noe n ening t noe i. Pths ening t non finl noes orrespon to strit lsses of ftors of the ongruene reltion Suf (S). The CDAWG for set of strings n e onstrute with the lgorithm presente in the previous setion. irst, we uil the CDAWG for string s (with the termintion symol) n finl noe. Notie tht, sine the termintion symol oes not our nywhere else in s, the resulting struture is CDAWG, with no nee to perform the itionl phse. Then, string s 2 is e to the grph, ut in this se with finl noe 2. The sme will pply to every other string in the set. Noe loning n ege reiretion rules ensure the orretness of the resulting struture. t n e prove tht the lgorithm tkes O(N) time to onstrut the struture, implemente with trnsition mtrix, where N = k i= si. This struture (with mrginl ifferenes) ws first esrie in [3], where it ws uilt y reuing DAWG. Therefore, ing new string to the set require the onstrution of new DAWG from srth. The lgorithm presente here, inste, permits to strings iretly to the ompt struture (see ig. 8). As in [3] we n give n upper oun on the size of the struture. Theorem 2 (Blumer et l., [3]). The CDAWG for set of strings s...s k, hs t most N + k noes, where N = k i= si. 5 Conlusions A CDAWG is spe effiient text inexing struture tht represents ll the sustrings of string. We presente new on line lgorithm for its onstrution, s well s the onstrution of CDAWG for set of strings. The sme strutures n e ompute y reution strting from the orresponing DAWGs or suffix trees; however, the pproh presente in this pper permits to sve time n spe simultneously, sine the CDAWGs n e uilt iretly. Moreover, one the struture hs een uilt for set of strings, new strings n e e iretly to the ompt struture.

12 80 Shunsuke neng et l. $ $ $ $ $ 2 $2 $2 2 ig. 8. CDAWG for strings $ n $ 2, fter the insertion of $ (left) n $ 2 (right). Chrters $ n $ 2 re use s termintions. Eges (,$, )n(,$ 2, 2 ) hve een omitte. Aknowlegements The Miln Bio group hs een supporte y the tlin Ministry of University, uner the projet Bioinformtis n Genomi Reserh. Referenes. U. Mner n G. Myers. Suffix rrys: new metho for on line string serhes. SAM J. Computing, 22(5): , J. Kärkkäinen. Suffix tus: ross etween suffix tree n suffix rry. Comintoril Pttern Mthing, 937:9 204, July A. Blumer, J. Blumer, D. Hussler, R. MConnell, n A. Ehrenfeuht. Complete inverte files for effiient text retrievl n nlysis. Journl of the ACM, 34(3): , A. Blumer, J. Blumer, D. Hussler, A. Ehrenfeuht, M. Chen, n J. Seifers. The smllest utomton reognizing the suwors of text. Theoretil Computer Siene, 40:3 55, M. Crohemore n R. Verin, On ompt irete yli wor grphs, Springer Verlg LNCS 26, pp.92 2, D. Gusfiel, Algorithms on Strings, Trees n Sequenes: Computer Siene n Computtionl Biology, Cmrige University Press, New York, E. MCreight. A spe eonomil suffix tree onstrution lgorithm. Journl of the ACM, 23(2): , E. Ukkonen. On line onstrution of suffix trees. Algorithmi, 4(3): , S. neng, H. Hoshino, A. Shinohr, M. Tke, n S. Arikw, On line onstrution of ompt irete yli wor grphs. DO Tehnil Report 83, Kyushu University, Jnury 200.

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

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

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

Prefix-Free Regular-Expression Matching

Prefix-Free Regular-Expression Matching Prefix-Free Regulr-Expression Mthing Yo-Su Hn, Yjun Wng nd Derik Wood Deprtment of Computer Siene HKUST Prefix-Free Regulr-Expression Mthing p.1/15 Pttern Mthing Given pttern P nd text T, find ll sustrings

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

General Suffix Automaton Construction Algorithm and Space Bounds

General Suffix Automaton Construction Algorithm and Space Bounds Generl Suffix Automton Constrution Algorithm nd Spe Bounds Mehryr Mohri,, Pedro Moreno, Eugene Weinstein, Cournt Institute of Mthemtil Sienes 251 Merer Street, New York, NY 10012. Google Reserh 76 Ninth

More information

Minimal DFA. minimal DFA for L starting from any other

Minimal DFA. minimal DFA for L starting from any other Miniml DFA Among the mny DFAs ccepting the sme regulr lnguge L, there is exctly one (up to renming of sttes) which hs the smllest possile numer of sttes. Moreover, it is possile to otin tht miniml DFA

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

Logic, Set Theory and Computability [M. Coppenbarger]

Logic, Set Theory and Computability [M. Coppenbarger] 14 Orer (Hnout) Definition 7-11: A reltion is qusi-orering (or preorer) if it is reflexive n trnsitive. A quisi-orering tht is symmetri is n equivlene reltion. A qusi-orering tht is nti-symmetri is n orer

More information

1 Nondeterministic Finite Automata

1 Nondeterministic Finite Automata 1 Nondeterministic Finite Automt Suppose in life, whenever you hd choice, you could try oth possiilities nd live your life. At the end, you would go ck nd choose the one tht worked out the est. Then you

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

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

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

McCreight s Suffix Tree Construction Algorithm. Milko Izamski B.Sc. Informatics Instructor: Barbara König

McCreight s Suffix Tree Construction Algorithm. Milko Izamski B.Sc. Informatics Instructor: Barbara König 1. Introution MCreight s Suffix Tree Constrution Algorithm Milko Izamski B.S. Informatis Instrutor: Barbara König The main goal of MCreight s algorithm is to buil a suffix tree in linear time. This is

More information

Compiler Design. Spring Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz

Compiler Design. Spring Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz University of Southern Cliforni Computer Siene Deprtment Compiler Design Spring 7 Lexil Anlysis Smple Exerises nd Solutions Prof. Pedro C. Diniz USC / Informtion Sienes Institute 47 Admirlty Wy, Suite

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

Regular expressions, Finite Automata, transition graphs are all the same!!

Regular expressions, Finite Automata, transition graphs are all the same!! CSI 3104 /Winter 2011: Introduction to Forml Lnguges Chpter 7: Kleene s Theorem Chpter 7: Kleene s Theorem Regulr expressions, Finite Automt, trnsition grphs re ll the sme!! Dr. Neji Zgui CSI3104-W11 1

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

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

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

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

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

Implication Graphs and Logic Testing

Implication Graphs and Logic Testing Implition Grphs n Logi Testing Vishwni D. Agrwl Jmes J. Dnher Professor Dept. of ECE, Auurn University Auurn, AL 36849 vgrwl@eng.uurn.eu www.eng.uurn.eu/~vgrwl Joint reserh with: K. K. Dve, ATI Reserh,

More information

= state, a = reading and q j

= state, a = reading and q j 4 Finite Automt CHAPTER 2 Finite Automt (FA) (i) Derterministi Finite Automt (DFA) A DFA, M Q, q,, F, Where, Q = set of sttes (finite) q Q = the strt/initil stte = input lphet (finite) (use only those

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

Direct construction of compact Directed Acyclic Word Graphs

Direct construction of compact Directed Acyclic Word Graphs Diret onstrution of ompt Direted Ayli Word Grphs Mxime Crohemore, Renud Vérin To ite this version: Mxime Crohemore, Renud Vérin. Diret onstrution of ompt Direted Ayli Word Grphs. Apostolio A nd Hein J.

More information

INTRODUCTION TO AUTOMATA THEORY

INTRODUCTION TO AUTOMATA THEORY Chpter 3 INTRODUCTION TO AUTOMATA THEORY In this hpter we stuy the most si strt moel of omputtion. This moel els with mhines tht hve finite memory pity. Setion 3. els with mhines tht operte eterministilly

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

GNFA GNFA GNFA GNFA GNFA

GNFA GNFA GNFA GNFA GNFA DFA RE NFA DFA -NFA REX GNFA Definition GNFA A generlize noneterministic finite utomton (GNFA) is grph whose eges re lele y regulr expressions, with unique strt stte with in-egree, n unique finl stte with

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

Formal Languages and Automata

Formal Languages and Automata Moile Computing nd Softwre Engineering p. 1/5 Forml Lnguges nd Automt Chpter 2 Finite Automt Chun-Ming Liu cmliu@csie.ntut.edu.tw Deprtment of Computer Science nd Informtion Engineering Ntionl Tipei University

More information

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER MACHINES AND THEIR LANGUAGES ANSWERS

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER MACHINES AND THEIR LANGUAGES ANSWERS The University of ottinghm SCHOOL OF COMPUTR SCIC A LVL 2 MODUL, SPRIG SMSTR 2015 2016 MACHIS AD THIR LAGUAGS ASWRS Time llowed TWO hours Cndidtes my omplete the front over of their nswer ook nd sign their

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

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

Intermediate Math Circles Wednesday 17 October 2012 Geometry II: Side Lengths

Intermediate Math Circles Wednesday 17 October 2012 Geometry II: Side Lengths Intermedite Mth Cirles Wednesdy 17 Otoer 01 Geometry II: Side Lengths Lst week we disussed vrious ngle properties. As we progressed through the evening, we proved mny results. This week, we will look t

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

@#? Text Search ] { "!" Nondeterministic Finite Automata. Transformation NFA to DFA and Simulation of NFA. Text Search Using Automata

@#? Text Search ] { ! Nondeterministic Finite Automata. Transformation NFA to DFA and Simulation of NFA. Text Search Using Automata g Text Serh @#? ~ Mrko Berezovský Rdek Mřík PAL 0 Nondeterministi Finite Automt n Trnsformtion NFA to DFA nd Simultion of NFA f Text Serh Using Automt A B R Power of Nondeterministi Approh u j Regulr Expression

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

Laboratory for Foundations of Computer Science. An Unfolding Approach. University of Edinburgh. Model Checking. Javier Esparza

Laboratory for Foundations of Computer Science. An Unfolding Approach. University of Edinburgh. Model Checking. Javier Esparza An Unfoling Approh to Moel Cheking Jvier Esprz Lbortory for Fountions of Computer Siene University of Einburgh Conurrent progrms Progrm: tuple P T 1 T n of finite lbelle trnsition systems T i A i S i i

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

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

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

Outline Data Structures and Algorithms. Data compression. Data compression. Lossy vs. Lossless. Data Compression

Outline Data Structures and Algorithms. Data compression. Data compression. Lossy vs. Lossless. Data Compression 5-2 Dt Strutures n Algorithms Dt Compression n Huffmn s Algorithm th Fe 2003 Rjshekr Rey Outline Dt ompression Lossy n lossless Exmples Forml view Coes Definition Fixe length vs. vrile length Huffmn s

More information

The size of subsequence automaton

The size of subsequence automaton Theoreticl Computer Science 4 (005) 79 84 www.elsevier.com/locte/tcs Note The size of susequence utomton Zdeněk Troníček,, Ayumi Shinohr,c Deprtment of Computer Science nd Engineering, FEE CTU in Prgue,

More information

CS 275 Automata and Formal Language Theory

CS 275 Automata and Formal Language Theory CS 275 utomt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Prolem (II) Chpter II.5.: Properties of Context Free Grmmrs (14) nton Setzer (Bsed on ook drft y J. V. Tucker nd K. Stephenson)

More information

Lecture 08: Feb. 08, 2019

Lecture 08: Feb. 08, 2019 4CS4-6:Theory of Computtion(Closure on Reg. Lngs., regex to NDFA, DFA to regex) Prof. K.R. Chowdhry Lecture 08: Fe. 08, 2019 : Professor of CS Disclimer: These notes hve not een sujected to the usul scrutiny

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

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

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1 Chpter Five: Nondeterministic Finite Automt Forml Lnguge, chpter 5, slide 1 1 A DFA hs exctly one trnsition from every stte on every symol in the lphet. By relxing this requirement we get relted ut more

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

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2 CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design nd Anlysis LECTURE 8 Mx. lteness ont d Optiml Ching Adm Smith 9/12/2008 A. Smith; sed on slides y E. Demine, C. Leiserson, S. Rskhodnikov, K. Wyne Sheduling to Minimizing Lteness Minimizing

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

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

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true. York University CSE 2 Unit 3. DFA Clsses Converting etween DFA, NFA, Regulr Expressions, nd Extended Regulr Expressions Instructor: Jeff Edmonds Don t chet y looking t these nswers premturely.. For ech

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

Designing finite automata II

Designing finite automata II Designing finite utomt II Prolem: Design DFA A such tht L(A) consists of ll strings of nd which re of length 3n, for n = 0, 1, 2, (1) Determine wht to rememer out the input string Assign stte to ech of

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

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 CMSC 330 1 Types of Finite Automt Deterministic Finite Automt (DFA) Exctly one sequence of steps for ech string All exmples so fr Nondeterministic

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

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

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

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

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

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb. CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt

More information

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages 5//6 Grmmr Automt nd Lnguges Regulr Grmmr Context-free Grmmr Context-sensitive Grmmr Prof. Mohmed Hmd Softwre Engineering L. The University of Aizu Jpn Regulr Lnguges Context Free Lnguges Context Sensitive

More information

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata CS103B ndout 18 Winter 2007 Ferury 28, 2007 Finite Automt Initil text y Mggie Johnson. Introduction Severl childrens gmes fit the following description: Pieces re set up on plying ord; dice re thrown or

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

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

Homework 3 Solutions

Homework 3 Solutions CS 341: Foundtions of Computer Science II Prof. Mrvin Nkym Homework 3 Solutions 1. Give NFAs with the specified numer of sttes recognizing ech of the following lnguges. In ll cses, the lphet is Σ = {,1}.

More information

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014 CMPSCI 250: Introduction to Computtion Lecture #31: Wht DFA s Cn nd Cn t Do Dvid Mix Brrington 9 April 2014 Wht DFA s Cn nd Cn t Do Deterministic Finite Automt Forml Definition of DFA s Exmples of DFA

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

Discrete Structures, Test 2 Monday, March 28, 2016 SOLUTIONS, VERSION α

Discrete Structures, Test 2 Monday, March 28, 2016 SOLUTIONS, VERSION α Disrete Strutures, Test 2 Mondy, Mrh 28, 2016 SOLUTIONS, VERSION α α 1. (18 pts) Short nswer. Put your nswer in the ox. No prtil redit. () Consider the reltion R on {,,, d with mtrix digrph of R.. Drw

More information

Data Structures and Algorithm. Xiaoqing Zheng

Data Structures and Algorithm. Xiaoqing Zheng Dt Strutures nd Algorithm Xioqing Zheng zhengxq@fudn.edu.n String mthing prolem Pttern P ours with shift s in text T (or, equivlently, tht pttern P ours eginning t position s + in text T) if T[s +... s

More information

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9. Regulr Expressions, Pumping Lemm, Right Liner Grmmrs Ling 106 Mrch 25, 2002 1 Regulr Expressions A regulr expression descries or genertes lnguge: it is kind of shorthnd for listing the memers of lnguge.

More information

Suffix Trays and Suffix Trists: Structures for Faster Text Indexing

Suffix Trays and Suffix Trists: Structures for Faster Text Indexing Suffix Trys nd Suffix Trists: Strutures for Fster Text Indexing Rihrd Cole Tsvi Kopelowitz Moshe Lewenstein rxiv:1311.1762v1 [s.ds] 7 Nov 2013 Astrt Suffix trees nd suffix rrys re two of the most widely

More information

Regular languages refresher

Regular languages refresher Regulr lnguges refresher 1 Regulr lnguges refresher Forml lnguges Alphet = finite set of letters Word = sequene of letter Lnguge = set of words Regulr lnguges defined equivlently y Regulr expressions Finite-stte

More information