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

Size: px
Start display at page:

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

Transcription

1 XML n Dtses Exm Prepertion Disuss Answers to lst yer s exm Sestin Mneth NICTA n UNSW CSE@UNSW -- Semester 1, 2008

2 (1) For eh of the following, explin why it is not well-forme XML (is WFC or the XML grmmr violte?) ) <uthor></uthor><title></title> ) <uthor><title></uthor></title> ) <info temp= 25C >ontent</info> ) <!DOCTYPE greeting [ <!ELEMENT greeting (#PCDATA)> <!ENTITY e1 "&e2; e3"> <!ENTITY e2 "&e3;"> <!ENTITY e3 "&e2;"> ]> <greeting> &e1; </greeting> e) < t1= lh t<2= foo > 1 < 5 </> f) < 3= 2= 1= 2= 5 /> g) <><><></></></>&e;</></> 2

3 (1) For eh of the following, explin why it is not well-forme XML (is WFC or the XML grmmr violte?) ) <uthor></uthor><title></title> XML grmmr (nnot e erive y grmmr!) ) <uthor><title></uthor></title> ) <info temp= 25C >ontent</info> ) <!DOCTYPE greeting [ <!ELEMENT greeting (#PCDATA)> <!ENTITY e1 "&e2; e3"> <!ENTITY e2 "&e3;"> <!ENTITY e3 "&e2;"> ]> <greeting> &e1; </greeting> e) < t1= lh t<2= foo > 1 < 5 </> f) < 3= 2= 1= 2= 5 /> g) <><><></></></>&e;</></> 3

4 (1) For eh of the following, explin why it is not well-forme XML (is WFC or the XML grmmr violte?) ) <uthor></uthor><title></title> XML grmmr ) <uthor><title></uthor></title> WFC ) <info temp= 25C >ontent</info> ) <!DOCTYPE greeting [ <!ELEMENT greeting (#PCDATA)> <!ENTITY e1 "&e2; e3"> <!ENTITY e2 "&e3;"> <!ENTITY e3 "&e2;"> ]> <greeting> &e1; </greeting> e) < t1= lh t<2= foo > 1 < 5 </> f) < 3= 2= 1= 2= 5 /> g) <><><></></></>&e;</></> 4

5 (1) For eh of the following, explin why it is not well-forme XML (is WFC or the XML grmmr violte?) ) <uthor></uthor><title></title> XML grmmr ) <uthor><title></uthor></title> WFC ) <info temp= 25C >ontent</info> XML grmmr (shoul e 25 ; -is tully OK..!) ) <!DOCTYPE greeting [ <!ELEMENT greeting (#PCDATA)> <!ENTITY e1 "&e2; e3"> <!ENTITY e2 "&e3;"> <!ENTITY e3 "&e2;"> ]> <greeting> &e1; </greeting> e) < t1= lh t<2= foo > 1 < 5 </> f) < 3= 2= 1= 2= 5 /> g) <><><></></></>&e;</></> 5

6 (1) For eh of the following, explin why it is not well-forme XML (is WFC or the XML grmmr violte?) ) <uthor></uthor><title></title> XML grmmr ) <uthor><title></uthor></title> WFC ) <info temp= 25C >ontent</info> XML grmmr (shoul e 25 ; -is tully OK..!) ) <!DOCTYPE greeting [ WFC <!ELEMENT greeting (#PCDATA)> <!ENTITY e1 "&e2; e3"> <!ENTITY e2 "&e3;"> <!ENTITY e3 "&e2;"> ]> <greeting> &e1; </greeting> e) < t1= lh t<2= foo > 1 < 5 </> f) < 3= 2= 1= 2= 5 /> g) <><><></></></>&e;</></> Well-formeness onstrint: No Reursion A prse entity MUST NOT ontin reursive referene to itself, either iretly or iniretly. 6

7 (1) For eh of the following, explin why it is not well-forme XML (is WFC or the XML grmmr violte?) ) <uthor></uthor><title></title> XML grmmr ) <uthor><title></uthor></title> WFC ) <info temp= 25C >ontent</info> XML grmmr (shoul e 25 ; -is tully OK..!) ) <!DOCTYPE greeting [ WFC <!ELEMENT greeting (#PCDATA)> <!ENTITY e1 "&e2; e3"> <!ENTITY e2 "&e3;"> <!ENTITY e3 "&e2;"> ]> <greeting> &e1; </greeting> e) < t1= lh t<2= foo > 1 < 5 </> XML grmmr f) < 3= 2= 1= 2= 5 /> g) <><><></></></>&e;</></> [41] Attriute ::= Nme Eq AttVlue [5] Nme ::= (Letter '_' ':') (NmeChr)* [84] Letter ::= [-za-z] 7

8 (1) For eh of the following, explin why it is not well-forme XML (is WFC or the XML grmmr violte?) ) <uthor></uthor><title></title> XML grmmr ) <uthor><title></uthor></title> WFC ) <info temp= 25C >ontent</info> XML grmmr (shoul e 25 ; -is tully OK..!) ) <!DOCTYPE greeting [ WFC <!ELEMENT greeting (#PCDATA)> <!ENTITY e1 "&e2; e3"> <!ENTITY e2 "&e3;"> <!ENTITY e3 "&e2;"> ]> <greeting> &e1; </greeting> e) < t1= lh t<2= foo > 1 < 5 </> XML grmmr f) < 3= 2= 1= 2= 5 /> WFC g) <><><></></></>&e;</></> Well-formeness onstrint: Unique Att Spe An ttriute nme MUST NOT pper more thn one in the sme strt-tg or empty-element tg. 8

9 (1) For eh of the following, explin why it is not well-forme XML (is WFC or the XML grmmr violte?) ) <uthor></uthor><title></title> XML grmmr ) <uthor><title></uthor></title> WFC ) <info temp= 25C >ontent</info> XML grmmr (shoul e 25 ; -is tully OK..!) ) <!DOCTYPE greeting [ WFC <!ELEMENT greeting (#PCDATA)> <!ENTITY e1 "&e2; e3"> <!ENTITY e2 "&e3;"> <!ENTITY e3 "&e2;"> ]> <greeting> &e1; </greeting> e) < t1= lh t<2= foo > 1 < 5 </> XML grmmr f) < 3= 2= 1= 2= 5 /> WFC g) <><><></></></>&e;</></> WFC Well-formeness onstrint: Entity Delre...the Nme given in the entity referene MUST mth tht in n entity elrtion tht... 9

10 (2) Show sequenes of Unioe hrters for whih ) UTF-8 nees more spe thn UTF-16 ) UTF-16 nees more spe thn UTF-8 together with the orresponing UTF oes n their lengths. ) Explin how to inry sort sequene of UTF-8 hrters. Use pseuo oe if pproprite. 10

11 (2) Show sequenes of Unioe hrters for whih ) UTF-8 nees more spe thn UTF-16 ) UTF-16 nees more spe thn UTF-8 together with the orresponing UTF oes n their lengths. ) Explin how to inry sort sequene of UTF-8 hrters. Use pseuo oe if pproprite. ) U+FFFF UTF-8: = 24its UTF-16: = 16its 11

12 (2) Show sequenes of Unioe hrters for whih ) UTF-8 nees more spe thn UTF-16 ) UTF-16 nees more spe thn UTF-8 together with the orresponing UTF oes n their lengths. ) Explin how to inry sort sequene of UTF-8 hrters. Use pseuo oe if pproprite. ) U+FFFF UTF-8: = 24its UTF-16: = 16its ) U+00 UTF-8: = 8its UTF-16: = 16its 12

13 (2) Show sequenes of Unioe hrters for whih ) UTF-8 nees more spe thn UTF-16 ) UTF-16 nees more spe thn UTF-8 together with the orresponing UTF oes n their lengths. ) Explin how to inry sort sequene of UTF-8 hrters. Use pseuo oe if pproprite. ) U+FFFF UTF-8: = 24its UTF-16: = 16its ) U+00 ) UTF-8: = 8its UTF-16: = 16its To inry ompre two hrters, simply strt from the highest it! In this wy, for hrters with ifferent lengths in UTF-8, fter 4 its we will e one! - In se UTF-8 lengths re sme norml inry ompre.. 13

14 (3) Show n element noe with mixe ontent, using the XML Informtion Set. Assume tht for noe M, Type(M) is it s type, i.e., is one of DOC, ELEM, ATTR, or CHAR. Using the Infoset, show pseuo oe tht, given noe N, ) returns ll nestors of the noe ) returns the previous siling of the noe. 14

15 (3) Show n element noe with mixe ontent, using the XML Informtion Set. Assume tht for noe M, Type(M) is it s type, i.e., is one of DOC, ELEM, ATTR, or CHAR. Using the Infoset, show pseuo oe tht, given noe N, ) returns ll nestors of the noe ) returns the previous siling of the noe. lolnme(e1) = elem hilren(e1) = [e2,1] lolnme(e2) = elem hilren(e2) = [] prent(e2) = e1 oe(1) = U+00 prent(1) = e1 ttriutes(e1) = [] ttriutes(e2) = [] 15

16 (3) Show n element noe with mixe ontent, using the XML Informtion Set. Assume tht for noe M, Type(M) is it s type, i.e., is one of DOC, ELEM, ATTR, or CHAR. Using the Infoset, show pseuo oe tht, given noe N, ) returns ll nestors of the noe ) returns the previous siling of the noe. lolnme(e1) = elem hilren(e1) = [e2,1] lolnme(e2) = elem hilren(e2) = [] prent(e2) = e1 oe(1) = U+00 prent(1) = e1 ttriutes(e1) = [] ttriutes(e2) = [] ) getanestors(noe n): NoeSet { NoeSet result=null; } if(n.type!=doc){ for(; n=n->prent ; n.type!= DOC ) A(n,result); A(n,result); } return result; 16

17 (3) Show n element noe with mixe ontent, using the XML Informtion Set. Assume tht for noe M, Type(M) is it s type, i.e., is one of DOC, ELEM, ATTR, or CHAR. Using the Infoset, show pseuo oe tht, given noe N, ) returns ll nestors of the noe ) returns the previous siling of the noe. lolnme(e1) = elem hilren(e1) = [e2,1] lolnme(e2) = elem hilren(e2) = [] prent(e2) = e1 oe(1) = U+00 prent(1) = e1 ttriutes(e1) = [] ttriutes(e2) = [] ) getanestors(noe n): NoeSet { NoeSet result=null; ) getprevsi(noe n): Noe { NoeList l=null; if(n.type!= DOC ) { Noe prent=n->prentnoe(); l=n->hilren; if(l==null) return NULL; s=first(l); if(s==l) return NULL; while(s->next!=n) s=s->next(); } return s; } } if(n.type!=doc){ for(; n=n->prent ; n.type!= DOC ) A(n,result); A(n,result); } return result; 17

18 (4) Using DOM, give pseuo oe tht etermines the verge epth of the XML tree. The verge epth of </> is 1. 18

19 (4) Using DOM, give pseuo oe tht etermines the verge epth of the XML tree. The verge epth of </> is 1. int totl=0; int ount=0; ll laverge(root, 1); return totl/ount; voi laverge(noe n, int epth) { NoeList hilren = n->hillist(); if(hilren->isempty()) { totl += epth; ount++; return; } else for eh Noe in hilren laverge(, epth+1); } 19

20 (5) Explin in etil, using n exmple, why hshing is useful for fining the miniml DAG of tree. Why re uptes more expensive on DAG thn on tree? Give n exmple tht lerly explins this. 20

21 (5) Explin in etil, using n exmple, why hshing is useful for fining the miniml DAG of tree. Why re uptes more expensive on DAG thn on tree? Give n exmple tht lerly explins this. When omputing the miniml DAG, we nee to etermine whether given sutree hs ourre lrey. If we keep tle of pointers to the sutrees tht hve ourre lrey, then to hek for given sutree whether or not it ours in the tle tkes in the worst se (#of trees in the tle) x (# noes in sutree) whih, in the worst se, is qurti to the size of the input tree! With hshing, we only nee (# trees in the hsh uket) x (# noes in the sutree). Thus, if uket hs only onstnt numer of trees, on verge, then the omplexity goes from qurti to liner! Exmple tree: k Seen:=NULL Seen:=seen + -tree Contins(Seen, -tree )? nees 1 omprison Seen:=Seen + -tree Contins(Seen, -tree )? nees 2 omprisons Seen:=Seen + -tree Contins(Seen, -tree )? nees 3 omprisons Seen:=Seen + -tree Assume hsh( -tree )=1 hsh( -tree )=2 hsh( -tree )=3 hsh( -tree )=4 Then we nee no (tree) omprisons whtsover! 21

22 (5) Explin in etil, using n exmple, why hshing is useful for fining the miniml DAG of tree. Why re uptes more expensive on DAG thn on tree? Give n exmple tht lerly explins this. DAG 1: 2: [1,1,1] Duplite noe 2 DAG Insert(2, -tree ) DAG 1: 2: 3: [1,2,1] 1: 2: 3: [2] 4: [1,3,1] Inserting single new hil require ing two rows n hnging one existing one. (the shre 2 n hil -sutree of the -noe must e uplite first, efore the -hil n e e. 22

23 (6) Give the PRE/POST tle for the tree <><></></><></><></></></></></><><></></></></> </></> ) Give pseuo oe tht omputes the POST orer of tree in n itertive wy, i.e., without ny reursive lls(!). You n use firstchil(n), nextsiling(n), n prent(n) for noe n. Using the PRE/POST-enoing, explin how to otin ) the nestors of noe ) the lst hil of noe e) the mximl epth of the sutree t noe. 23

24 (6) Give the PRE/POST tle for the tree <><></></><></><></></></></></><><></></></></> </></> ) Give pseuo oe tht omputes the POST orer of tree in n itertive wy, i.e., without ny reursive lls(!). You n use firstchil(n), nextsiling(n), n prent(n) for noe n. Using the PRE/POST-enoing, explin how to otin ) the nestors of noe ) the lst hil of noe e) the mximl epth of the sutree t noe PRE POST lel

25 (6) Give the PRE/POST tle for the tree <><></></><></><></></></></></><><></></></></> </></> ) Give pseuo oe tht omputes the POST orer of tree in n itertive wy, i.e., without ny reursive lls(!). You n use firstchil(n), nextsiling(n), n prent(n) for noe n. Using the PRE/POST-enoing, explin how to otin ) the nestors of noe ) the lst hil of noe e) the mximl epth of the sutree t noe. ) int i=1; Noe n=root; repet{ while(firstchil(n)!=null) n=firstchil(n); post(i)=n; i++; while(nextsiling(n)==nil){ n=prent(n); if(n==null) rek; post(i)=n; i++; } n=nextsiling(n); } 25

26 (6) Give the PRE/POST tle for the tree <><></></><></><></></></></></><><></></></></> </></> ) Give pseuo oe tht omputes the POST orer of tree in n itertive wy, i.e., without ny reursive lls(!). You n use firstchil(n), nextsiling(n), n prent(n) for noe n. Using the PRE/POST-enoing, explin how to otin ) the nestors of noe ) the lst hil of noe e) the mximl epth of the sutree t noe. ) Given (pre, post) of noe, its nestors re ll noes with pre-vlue < pre n post-vlue > post. 26

27 (6) Give the PRE/POST tle for the tree <><></></><></><></></></></></><><></></></></> </></> ) Give pseuo oe tht omputes the POST orer of tree in n itertive wy, i.e., without ny reursive lls(!). You n use firstchil(n), nextsiling(n), n prent(n) for noe n. Using the PRE/POST-enoing, explin how to otin ) the nestors of noe ) the lst hil of noe e) the mximl epth of the sutree t noe. ) Given (pre, post) of noe, its nestors re ll noes with pre-vlue < pre n post-vlue > post. ) If there i noe with pre-vlue > pre n with post-vlue=post-1, then tht is the lst hil of (pre, post) 27

28 (6) Give the PRE/POST tle for the tree <><></></><></><></></></></></><><></></></></> </></> ) Give pseuo oe tht omputes the POST orer of tree in n itertive wy, i.e., without ny reursive lls(!). You n use firstchil(n), nextsiling(n), n prent(n) for noe n. Using the PRE/POST-enoing, explin how to otin ) the nestors of noe ) the lst hil of noe e) the mximl epth of the sutree t noe. ) Given (pre, post) of noe, its nestors re ll noes with pre-vlue < pre n post-vlue > post. ) If there i noe with pre-vlue > pre n with post-vlue=post-1, then tht is the lst hil of (pre, post) e) int mxdepth(int pr){ size(int p): int{ int s=0; for(int pr2=p+1; post(pr2)<post(p); pr2++) s++ return s; } int D=0; int u,l; L=pr+size(pr)-post(pr); for(int pr2=pr+1; post(pr2)<post(pr); pr2++){ u=pr2+size(pr2)-post(pr2)-l; if(u>d) D=u; return D; } 28

29 (8) Show the Glushkov utomton for the regulr expression E=( )*. Is this expression 1-unmiguous? Explin! Give eterministi utomton for the sme expression. Is E2=(*( ))* equivlent to E? Is it 1-unmiguous? Show 1-unmiguous expression tht is equivlent to ( )*. 29

30 (8) Show the Glushkov utomton for the regulr expression E=( )*. Is this expression 1-unmiguous? Explin! Give eterministi utomton for the sme expression. Is E2=(*( ))* equivlent to E? Is it 1-unmiguous? Show 1-unmiguous expression tht is equivlent to ( )*. Deterministi?? 30

31 (8) Show the Glushkov utomton for the regulr expression E=( )*. Is this expression 1-unmiguous? Explin! Give eterministi utomton for the sme expression. Is E2=(*( ))* equivlent to E? Is it 1-unmiguous? Show 1-unmiguous expression tht is equivlent to ( )*. Deterministi?? no! Thus, E is not 1-unmiguous. 31

32 (8) Show the Glushkov utomton for the regulr expression E=( )*. Is this expression 1-unmiguous? Explin! Give eterministi utomton for the sme expression. Is E2=(*( ))* equivlent to E? Is it 1-unmiguous? Show 1-unmiguous expression tht is equivlent to ( )*. Deterministi utomton: 32

33 (8) Show the Glushkov utomton for the regulr expression E=( )*. Is this expression 1-unmiguous? Explin! Give eterministi utomton for the sme expression. Is E2=(*( ))* equivlent to E? Is it 1-unmiguous? Show 1-unmiguous expression tht is equivlent to ( )*. NOT equivlent to E! The string is mthe y E, ut NOT y E2. E2 is NOT 1-unmiguous: 33

34 (8) Show the Glushkov utomton for the regulr expression E=( )*. Is this expression 1-unmiguous? Explin! Give eterministi utomton for the sme expression. Is E2=(*( ))* equivlent to E? Is it 1-unmiguous? Show 1-unmiguous expression tht is equivlent to ( )*. The expression *(*)* is equivlent to E 1-unmiguous. 34

35 (9) For the tree given in 6, write XPth expressions tht ) selet ll noes ) selet ll noes tht hve -hil ) selet ll noes tht hve no -hilren ) selet the right most -noe e) selet ll noes tht hve -prent <><></></><></><></></></></></><><></></></></> </></> 1: 2: 4: 9: 10: 3: 5: 6: 11: 14: Wth out! This is typo on your Exm printout.. Sorry. 7: 8: 12: 13: 35

36 (9) For the tree given in 6, write XPth expressions tht ) selet ll noes ) selet ll noes tht hve -hil ) selet ll noes tht hve no -hilren ) selet the right most -noe e) selet ll noes tht hve -prent <><></></><></><></></></></></><><></></></></> </></> 1: ) // 2: 4: 9: 10: 3: 5: 6: 11: 14: 7: 8: 12: 13: 36

37 (9) For the tree given in 6, write XPth expressions tht ) selet ll noes ) selet ll noes tht hve -hil ) selet ll noes tht hve no -hilren ) selet the right most -noe e) selet ll noes tht hve -prent <><></></><></><></></></></></><><></></></></> </></> 1: 2: 4: 9: 10: ) // ) //[] 3: 5: 6: 11: 14: 7: 8: 12: 13: 37

38 (9) For the tree given in 6, write XPth expressions tht ) selet ll noes ) selet ll noes tht hve -hil ) selet ll noes tht hve no -hilren ) selet the right most -noe e) selet ll noes tht hve -prent <><></></><></><></></></></></><><></></></></> </></> 1: 2: 4: 9: 10: ) // ) //[] 3: 5: 6: 11: 14: ) //[not()] 7: 8: 12: 13: 38

39 (9) For the tree given in 6, write XPth expressions tht ) selet ll noes ) selet ll noes tht hve -hil ) selet ll noes tht hve no -hilren ) selet the right most -noe (noe no 11) e) selet ll noes tht hve -prent <><></></><></><></></></></></><><></></></></> </></> 1: 2: 4: 9: 10: 3: 5: 6: 7: 8: 11: 12: 14: 13: ) // ) //[] ) //[not()] ) //[] or //[ n ] 39

40 (9) For the tree given in 6, write XPth expressions tht ) selet ll noes ) selet ll noes tht hve -hil ) selet ll noes tht hve no -hilren ) selet the right most -noe (noe no 11) e) selet ll noes tht hve -prent <><></></><></><></></></></></><><></></></></> </></> 1: 2: 4: 9: 10: 3: 5: 6: 7: 8: 11: 12: 14: 13: ) // ) //[] ) //[not()] ) //[] or //[ n ] e) //*[prent::] or ///* 40

41 (10) Below is tree orresponing to the oument in (6). Show the sequenes of noe numers tht re selete y the following queries. ) //// ) //*[ or ] ) ///nestor::/following:: ) //*[not(.//./nestor::)] e) /////preeing::*// 1: 2: 4: 9: 10: 3: 5: 6: 11: 14: 7: 8: 12: 13: 41

42 (10) Below is tree orresponing to the oument in (6). Show the sequenes of noe numers tht re selete y the following queries. ) //// ) //*[ or ] ) ///nestor::/following:: ) //*[not(.//./nestor::)] e) /////preeing::*// 1: ) 5, 6, 13 2: 4: 9: 10: 3: 5: 6: 11: 14: 7: 8: 12: 13: 42

43 (10) Below is tree orresponing to the oument in (6). Show the sequenes of noe numers tht re selete y the following queries. ) //// ) //*[ or ] ) ///nestor::/following:: ) //*[not(.//./nestor::)] e) /////preeing::*// 1: 2: 4: 9: 10: ) 5, 6, 13 ) 1, 6, 11 3: 5: 6: 11: 14: 7: 8: 12: 13: 43

44 (10) Below is tree orresponing to the oument in (6). Show the sequenes of noe numers tht re selete y the following queries. ) //// ) //*[ or ] ) ///nestor::/following:: ) //*[not(.//./nestor::)] e) /////preeing::*// 1: 2: 4: 9: 10: 3: 5: 6: 11: 14: ) 5, 6, 13 ) 1, 6, 11 ) 9, 13, 14 7: 8: 12: 13: 44

45 (10) This tree orresponing to the XML in (6). Show the sequenes of noe numers tht re selete y the following queries. ) //// ) //*[ or ] ) ///nestor::/following:: ) //*[not(.//./nestor::)] e) /////preeing::*// 1: 2: 4: 9: 10: 3: 5: 6: 11: 14: ) 5, 6, 13 ) 1, 6, 11 ) 9, 13, 14 ) 2, 3, 9, 14 7: 8: 12: 13: 45

46 (10) This tree orresponing to the XML in (6). Show the sequenes of noe numers tht re selete y the following queries. ) //// ) //*[ or ] ) ///nestor::/following:: ) //*[not(.//./nestor::)] e) /////preeing::*// 1: 2: 4: 9: 10: 3: 5: 6: 11: 14: ) 5, 6, 13 ) 1, 6, 11 ) 9, 13, 14 ) 2, 3, 9, 14 7: 8: 12: 13: e) 5, 6 46

47 (10) This tree orresponing to the XML in (6). ) ///nestor::/following:: ) //*[not(.//./nestor::)] For query ) show in etil how the Core-XPth evlution lgorithm omputes the nswer to this query. Do the sme for query ). 0:root 1: 2: 4: 9: 10: 3: 5: 6: 11: 14: Å following l() Å nestor l() 7: 8: 12: l() = { 1 } l() = { 2, 7, 8, 10, 12 } l() = { 3, 4, 11 } l() = { 5, 6, 9, 13, 14 } 13: esennt { root } Å l() 47

48 (10) This tree orresponing to the XML in (6). ) ///nestor::/following:: ) //*[not(.//./nestor::)] For query ) show in etil how the Core-XPth evlution lgorithm omputes the nswer to this query. Do the sme for query ). 0:root 1: 2: 4: 9: 10: 3: 5: 6: 11: 14:? Å following l() Å {5,6,9,13,14} nestor l() 7: 8: 12: l() = { 1 } l() = { 2, 7, 8, 10, 12 } l() = { 3, 4, 11 } l() = { 5, 6, 9, 13, 14 } 13: Å {1,2,..,14} esennt { root } {0} l() {2,7,8,10,12} 48

49 (10) This tree orresponing to the XML in (6). ) ///nestor::/following:: ) //*[not(.//./nestor::)] For query ) show in etil how the Core-XPth evlution lgorithm omputes the nswer to this query. Do the sme for query ). 0:root 1: 2: 4: 9: 10: 3: 5: 6: 11: 14: Å following l() {0,1,4,6,10,11} Å {5,6,9,13,14} nestor l() 7: 8: 12: l() = { 1 } l() = { 2, 7, 8, 10, 12 } l() = { 3, 4, 11 } l() = { 5, 6, 9, 13, 14 } 13: Å {1,2,..,14} esennt { root } {0} l() {2,7,8,10,12} 49

50 (10) This tree orresponing to the XML in (6). ) ///nestor::/following:: ) //*[not(.//./nestor::)] For query ) show in etil how the Core-XPth evlution lgorithm omputes the nswer to this query. Do the sme for query ). 0:root 1: 2: 4: 9: 10: 3: 5: 6: 11: 14: Å following l() {0,1,4,6,10,11} {6} Å {5,6,9,13,14} nestor l() 7: 8: 12: l() = { 1 } l() = { 2, 7, 8, 10, 12 } l() = { 3, 4, 11 } l() = { 5, 6, 9, 13, 14 } 13: Å {1,2,..,14} esennt { root } {0} l() {2,7,8,10,12} 50

51 (10) This tree orresponing to the XML in (6). ) ///nestor::/following:: ) //*[not(.//./nestor::)] For query ) show in etil how the Core-XPth evlution lgorithm omputes the nswer to this query. Do the sme for query ). 0:root 1: 2: 4: 9: 10: 3: 5: 6: 11: 14: {9,13,14} Å {9,10,..,14} {5,6,9,13,14} following l() {0,1,4,6,10,11} {6} Å {5,6,9,13,14} nestor l() 7: 8: 12: l() = { 1 } l() = { 2, 7, 8, 10, 12 } l() = { 3, 4, 11 } l() = { 5, 6, 9, 13, 14 } 13: Å {1,2,..,14} esennt { root } {0} l() {2,7,8,10,12} 51

52 (10) This tree orresponing to the XML in (6). ) ///nestor::/following:: ) //*[not(.//./nestor::)] For query ) show in etil how the Core-XPth evlution lgorithm omputes the nswer to this query. Do the sme for query ). 0:root 1: {1,2,..,14} Å esennt l(*) 2: 4: 9: 10: {1,2,..,14} { root } 3: 5: 6: 11: 14: {0} 7: 8: 12: 13: l() = { 1 } l() = { 2, 7, 8, 10, 12 } l() = { 3, 4, 11 } l() = { 5, 6, 9, 13, 14 } 52

53 (10) This tree orresponing to the XML in (6). ) ///nestor::/following:: ) //*[not(.//./nestor::)] For query ) show in etil how the Core-XPth evlution lgorithm omputes the nswer to this query. Do the sme for query ). 0:root 1: {1,2,..,14} Å esennt l(*) 2: 4: 9: 10: {1,2,..,14} { root } 3: 5: 6: 11: 14: {0} Å - 7: 8: 12: l() = { 1 } l() = { 2, 7, 8, 10, 12 } l() = { 3, 4, 11 } l() = { 5, 6, 9, 13, 14 } 13: om nestor l() esennt l() {2,7,8,10,12} {3,4,11} 53

54 (10) This tree orresponing to the XML in (6). ) ///nestor::/following:: ) //*[not(.//./nestor::)] For query ) show in etil how the Core-XPth evlution lgorithm omputes the nswer to this query. Do the sme for query ). 0:root 1: {1,2,..,14} Å esennt l(*) 2: 4: 9: 10: {1,2,..,14} { root } 3: 5: 6: 11: 14: {0} Å - 7: 8: 12: l() = { 1 } l() = { 2, 7, 8, 10, 12 } l() = { 3, 4, 11 } l() = { 5, 6, 9, 13, 14 } 13: om {5-8,12,13} {1,4,6,10,11} nestor esennt l() l() {2,7,8,10,12} {3,4,11} 54

55 (10) This tree orresponing to the XML in (6). ) ///nestor::/following:: ) //*[not(.//./nestor::)] For query ) show in etil how the Core-XPth evlution lgorithm omputes the nswer to this query. Do the sme for query ). 0:root 1: {1,2,..,14} Å esennt l(*) 2: 4: 9: 10: {1,2,..,14} { root } 3: 5: 6: 11: 14: {0} 7: 8: 12: l() = { 1 } l() = { 2, 7, 8, 10, 12 } l() = { 3, 4, 11 } l() = { 5, 6, 9, 13, 14 } 13: {0-14} om {1,4,6,10,11} Å - nestor {1,4-8,10-13} {5-8,12,13} esennt l() l() {2,7,8,10,12} {3,4,11} 55

56 (10) This tree orresponing to the XML in (6). ) ///nestor::/following:: ) //*[not(.//./nestor::)] For query ) show in etil how the Core-XPth evlution lgorithm omputes the nswer to this query. Do the sme for query ). 0:root 1: {1,2,..,14} Å esennt l(*) 2: 4: 9: 10: {1,2,..,14} { root } 3: 5: 6: 11: 14: {0} {0-14} 7: 8: 12: 13: om l() = { 1 } l() = { 2, 7, 8, 10, 12 } l() = { 3, 4, 11 } l() = { 5, 6, 9, 13, 14 } {1,4,6,10,11} Å - nestor {0,2,3,9,14} {1,4-8,10-13} {5-8,12,13} esennt l() l() {2,7,8,10,12} {3,4,11} 56

57 (10) This tree orresponing to the XML in (6). ) ///nestor::/following:: ) //*[not(.//./nestor::)] For query ) show in etil how the Core-XPth evlution lgorithm omputes the nswer to this query. Do the sme for query ). 0:root 1: {1,2,..,14} Å esennt l(*) 2: 4: 9: 10: {1,2,..,14} { root } 3: 5: 6: 11: 14: {0} {0-14} 7: 8: 12: 13: om l() = { 1 } l() = { 2, 7, 8, 10, 12 } l() = { 3, 4, 11 } l() = { 5, 6, 9, 13, 14 } {1,4,6,10,11} Å - nestor {2,3,9,14} {0,2,3,9,14} {1,4-8,10-13} {5-8,12,13} esennt l() l() {2,7,8,10,12} {3,4,11} 57

58 (11) Show n exmple of XPth queries q1,q2 suh tht they re not equivlent, ut q1 is inlue in q2. Show tht q1 is inlue in q2 using one of the methos isusse. Use the homomorphism tehnique to test whether p=[.//[/*//]/[//]/[/]] is inlue in q=[.//[//*//]/*[/]] 58

59 (11) Show n exmple of XPth queries q1,q2 suh tht they re not equivlent, ut q1 is inlue in q2. Show tht q1 is inlue in q2 using one of the methos isusse. Use the homomorphism tehnique to test whether p=[.//[/*//]/[//]/[/]] is inlue in q=[.//[//*//]/*[/]] q1 = /// q2 = // or q1 = // q2 = //* 59

60 (11) Show n exmple of XPth queries q1,q2 suh tht they re not equivlent, ut q1 is inlue in q2. Show tht q1 is inlue in q2 using one of the methos isusse. Use the homomorphism tehnique to test whether p=[.//[/*//]/[//]/[/]] is inlue in q=[.//[//*//]/*[/]] q1 = /// q2 = // Cnonil moel: Reple in q1 // y N+1 mny /z/ 0, here z Do they mth q2? yes!! or q1 = // q2 = //* 60

61 (11) Show n exmple of XPth queries q1,q2 suh tht they re not equivlent, ut q1 is inlue in q2. Show tht q1 is inlue in q2 using one of the methos isusse. Use the homomorphism tehnique to test whether p=[.//[/*//]/[//]/[/]] is inlue in q=[.//[//*//]/*[/]] * * * 61

62 (11) Show n exmple of XPth queries q1,q2 suh tht they re not equivlent, ut q1 is inlue in q2. Show tht q1 is inlue in q2 using one of the methos isusse. Use the homomorphism tehnique to test whether p=[.//[/*//]/[//]/[/]] is inlue in q=[.//[//*//]/*[/]] * * * 62

63 (11) Show n exmple of XPth queries q1,q2 suh tht they re not equivlent, ut q1 is inlue in q2. Show tht q1 is inlue in q2 using one of the methos isusse. Use the homomorphism tehnique to test whether p=[.//[/*//]/[//]/[/]] is inlue in q=[.//[//*//]/*[/]] * * * 63

64 (11) Show n exmple of XPth queries q1,q2 suh tht they re not equivlent, ut q1 is inlue in q2. Show tht q1 is inlue in q2 using one of the methos isusse. Use the homomorphism tehnique to test whether p=[.//[/*//]/[//]/[/]] is inlue in q=[.//[//*//]/*[/]] * * * 64

65 (11) Show n exmple of XPth queries q1,q2 suh tht they re not equivlent, ut q1 is inlue in q2. Show tht q1 is inlue in q2 using one of the methos isusse. Use the homomorphism tehnique to test whether p=[.//[/*//]/[//]/[/]] is inlue in q=[.//[//*//]/*[/]] * * * 65

66 (11) Show n exmple of XPth queries q1,q2 suh tht they re not equivlent, ut q1 is inlue in q2. Show tht q1 is inlue in q2 using one of the methos isusse. Use the homomorphism tehnique to test whether p=[.//[/*//]/[//]/[/]] is inlue in q=[.//[//*//]/*[/]] * * * Cn not e mppe. 66

67 (11) Show n exmple of XPth queries q1,q2 suh tht they re not equivlent, ut q1 is inlue in q2. Show tht q1 is inlue in q2 using one of the methos isusse. Use the homomorphism tehnique to test whether p=[.//[/*//]/[//]/[/]] is inlue in q=[.//[//*//]/*[/]] * * * Cn not e mppe. Note: p is inlue in q!! 67

68 (11) Show n exmple of XPth queries q1,q2 suh tht they re not equivlent, ut q1 is inlue in q2. Show tht q1 is inlue in q2 using one of the methos isusse. Use the homomorphism tehnique to test whether p=[.//[/*//]/[//]/[/]] is inlue in q=[.//[//*//]/*[/]] * * * Cse 1: hs -hil Why? Cse 2: hs no -hil Note: p is inlue in q!! 68

69 (11) Show n exmple of XPth queries q1,q2 suh tht they re not equivlent, ut q1 is inlue in q2. Show tht q1 is inlue in q2 using one of the methos isusse. Use the homomorphism tehnique to test whether p=[.//[/*//]/[//]/[/]] is inlue in q=[.//[//*//]/*[/]] OK!! p inlue in q, for Cse 1! * * * Cse 1: hs -hil Why? Cse 2: hs no -hil Note: p is inlue in q!! 69

70 (11) Show n exmple of XPth queries q1,q2 suh tht they re not equivlent, ut q1 is inlue in q2. Show tht q1 is inlue in q2 using one of the methos isusse. Use the homomorphism tehnique to test whether p=[.//[/*//]/[//]/[/]] is inlue in q=[.//[//*//]/*[/]] Also OK!! p inlue in q, for Cse 2! * * * * Cse 2: hs no -hil Why? Note: p is inlue in q!! 70

71 (12) Construt DTD suh tht 10) is inlue in 10e), n nother DTD suh tht 10e) is inlue in 10). [Very esy!!] 10) //// 10e) /////preeing::*// 71

72 (12) Construt DTD suh tht 10) is inlue in 10e), n nother DTD suh tht 10e) is inlue in 10). [Very esy!!] 10) //// 10e) /////preeing::*// For the first prt: *Any DTD* so tht -noes o NOT hve -esennts! For the seon prt: Any DTD, so tht ll -noes re -esennts. 72

73 (14) Given PRE/POST/SIZE tle, show SQL queries for the XPth queries ) /* ) ///* ) ///*// ) ///following-siling:: 73

74 (14) Given PRE/POST/SIZE tle, show SQL queries for the XPth queries ) /* ) ///* ) ///*// ) ///following-siling:: SELECT DISTINCT r1.pre FROM o_tl r1 WHERE r1.pre=1 ORDERED BY r1.pr 74

75 (14) Given PRE/POST/SIZE tle, show SQL queries for the XPth queries ) /* ) ///* ) ///*// ) ///following-siling:: SELECT DISTINCT r4.pre FROM o_tl r1, r2, r3, r4 WHERE r1.pre=0 AND r2.pre>r1.pre AND r2.post<r1.post AND (r2.pre-r2.post+r2.size)=(r1.pre-r1.post+r1.size)+1 AND r2.tg= AND r3.pre>r2.pre AND r3.post<r2.post AND (r3.pre-r3.post+r3.size)=(r2.pre-r2.post+r2.size)+1 AND r3.tg= AND r4.pre>r3.pre AND r4.post<r3.post AND (r4.pre-r4.post+r4.size)=(r3.pre-r3.post+r3.size)+1 ORDERED BY r4.pre Rell: level(n) = pre(n) post(n)+size(n) 75

76 (14) Given PRE/POST/SIZE tle, show SQL queries for the XPth queries ) /* ) ///* ) ///*// ) ///following-siling:: SELECT DISTINCT r4.pre FROM o_tl r1, r2, r3, r4 WHERE r1.pre=0 AND r2.pre>r1.pre AND r2.post<r1.post AND r2.tg= AND r3.pre>r2.pre AND r3.post<r2.post AND (r3.pre-r3.post+r3.size)=(r2.pre-r2.post+r2.size)+1 AND r4.pre>r3.pre AND r4.post<r3.post AND r4.tg= ORDERED BY r4.pre Rell: level(n) = pre(n) post(n)+size(n) 76

77 (14) Given PRE/POST/SIZE tle, show SQL queries for the XPth queries ) /* ) ///* ) ///*// ) ///following-siling:: SELECT DISTINCT r4.pre FROM o_tl r1, r2, r3, r4 WHERE r1.pre=0 AND r2.pre>r1.pre AND r2.post<r1.post AND r2.tg= AND r3.pre<r2.pre AND r3.post>r2.post AND (r3.pre-r3.post+r3.size)=(r2.pre-r2.post+r2.size)-1 AND r4.pre>r2.pre AND r4.post<r3.post AND (r4.pre-r4.post+r4.size)=(r2.pre-r2.post+r2.size) AND r4.tg= ORDERED BY r4.pre prent of -noe fter efore prent sme level s Rell: level(n) = pre(n) post(n)+size(n) 77

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

XML and Databases. Outline. 1. Top-Down Evaluation of Simple Paths. 1. Top-Down Evaluation of Simple Paths. 1. Top-Down Evaluation of Simple Paths

XML and Databases. Outline. 1. Top-Down Evaluation of Simple Paths. 1. Top-Down Evaluation of Simple Paths. 1. Top-Down Evaluation of Simple Paths Outline Leture Effiient XPth Evlution XML n Dtses. Top-Down Evlution of simple pths. Noe Sets only: Core XPth. Bottom-Up Evlution of Core XPth. Polynomil Time Evlution of Full XPth Sestin Mneth NICTA n

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

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

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

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

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

CSE : Exam 3-ANSWERS, Spring 2011 Time: 50 minutes

CSE : Exam 3-ANSWERS, Spring 2011 Time: 50 minutes CSE 260-002: Exm 3-ANSWERS, Spring 20 ime: 50 minutes Nme: his exm hs 4 pges nd 0 prolems totling 00 points. his exm is closed ook nd closed notes.. Wrshll s lgorithm for trnsitive closure computtion is

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

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

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

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

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

CS241 Week 6 Tutorial Solutions

CS241 Week 6 Tutorial Solutions 241 Week 6 Tutoril olutions Lnguges: nning & ontext-free Grmmrs Winter 2018 1 nning Exerises 1. 0x0x0xd HEXINT 0x0 I x0xd 2. 0xend--- HEXINT 0xe I nd ER -- MINU - 3. 1234-120x INT 1234 INT -120 I x 4.

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

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

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

First Midterm Examination

First Midterm Examination 24-25 Fll Semester First Midterm Exmintion ) Give the stte digrm of DFA tht recognizes the lnguge A over lphet Σ = {, } where A = {w w contins or } 2) The following DFA recognizes the lnguge B over lphet

More information

CS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS

CS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS CS 310 (sec 20) - Winter 2003 - Finl Exm (solutions) SOLUTIONS 1. (Logic) Use truth tles to prove the following logicl equivlences: () p q (p p) (q q) () p q (p q) (p q) () p q p q p p q q (q q) (p p)

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

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

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages Deprtment of Computer Science, Austrlin Ntionl University COMP2600 Forml Methods for Softwre Engineering Semester 2, 206 Assignment Automt, Lnguges, nd Computility Smple Solutions Finite Stte Automt nd

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

Tutorial Worksheet. 1. Find all solutions to the linear system by following the given steps. x + 2y + 3z = 2 2x + 3y + z = 4.

Tutorial Worksheet. 1. Find all solutions to the linear system by following the given steps. x + 2y + 3z = 2 2x + 3y + z = 4. Mth 5 Tutoril Week 1 - Jnury 1 1 Nme Setion Tutoril Worksheet 1. Find ll solutions to the liner system by following the given steps x + y + z = x + y + z = 4. y + z = Step 1. Write down the rgumented mtrix

More information

Instructions. An 8.5 x 11 Cheat Sheet may also be used as an aid for this test. MUST be original handwriting.

Instructions. An 8.5 x 11 Cheat Sheet may also be used as an aid for this test. MUST be original handwriting. ID: B CSE 2021 Computer Orgniztion Midterm Test (Fll 2009) Instrutions This is losed ook, 80 minutes exm. The MIPS referene sheet my e used s n id for this test. An 8.5 x 11 Chet Sheet my lso e used s

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

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

NFA DFA Example 3 CMSC 330: Organization of Programming Languages. Equivalence of DFAs and NFAs. Equivalence of DFAs and NFAs (cont.

NFA DFA Example 3 CMSC 330: Organization of Programming Languages. Equivalence of DFAs and NFAs. Equivalence of DFAs and NFAs (cont. NFA DFA Exmple 3 CMSC 330: Orgniztion of Progrmming Lnguges NFA {B,D,E {A,E {C,D {E Finite Automt, con't. R = { {A,E, {B,D,E, {C,D, {E 2 Equivlence of DFAs nd NFAs Any string from {A to either {D or {CD

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

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

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

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

Let's start with an example:

Let's start with an example: Finite Automt Let's strt with n exmple: Here you see leled circles tht re sttes, nd leled rrows tht re trnsitions. One of the sttes is mrked "strt". One of the sttes hs doule circle; this is terminl stte

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

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

Exercises Chapter 1. Exercise 1.1. Let Σ be an alphabet. Prove wv = w + v for all strings w and v.

Exercises Chapter 1. Exercise 1.1. Let Σ be an alphabet. Prove wv = w + v for all strings w and v. 1 Exercises Chpter 1 Exercise 1.1. Let Σ e n lphet. Prove wv = w + v for ll strings w nd v. Prove # (wv) = # (w)+# (v) for every symol Σ nd every string w,v Σ. Exercise 1.2. Let w 1,w 2,...,w k e k strings,

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

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

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

Parse trees, ambiguity, and Chomsky normal form

Parse trees, ambiguity, and Chomsky normal form Prse trees, miguity, nd Chomsky norml form In this lecture we will discuss few importnt notions connected with contextfree grmmrs, including prse trees, miguity, nd specil form for context-free grmmrs

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

Worked out examples Finite Automata

Worked out examples Finite Automata Worked out exmples Finite Automt Exmple Design Finite Stte Automton which reds inry string nd ccepts only those tht end with. Since we re in the topic of Non Deterministic Finite Automt (NFA), we will

More information

Formal languages, automata, and theory of computation

Formal languages, automata, and theory of computation Mälrdlen University TEN1 DVA337 2015 School of Innovtion, Design nd Engineering Forml lnguges, utomt, nd theory of computtion Thursdy, Novemer 5, 14:10-18:30 Techer: Dniel Hedin, phone 021-107052 The exm

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

A Rewrite Approach for Pattern Containment

A Rewrite Approach for Pattern Containment A Rewrite Approh or Pttern Continment Brr Kory rr.kory@univ-orlens.r LIFO - Université Orléns, Frne Astrt. In this pper we introue n pproh tht llows to hnle the ontinment prolem or the rgment XP(/,//,[

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

Closure Properties of Regular Languages

Closure Properties of Regular Languages Closure Properties of Regulr Lnguges Regulr lnguges re closed under mny set opertions. Let L 1 nd L 2 e regulr lnguges. (1) L 1 L 2 (the union) is regulr. (2) L 1 L 2 (the conctention) is regulr. (3) L

More information

Regular Languages and Applications

Regular Languages and Applications Regulr Lnguges nd Applictions Yo-Su Hn Deprtment of Computer Science Yonsei University 1-1 SNU 4/14 Regulr Lnguges An old nd well-known topic in CS Kleene Theorem in 1959 FA (finite-stte utomton) constructions:

More information

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.) CS 373, Spring 29. Solutions to Mock midterm (sed on first midterm in CS 273, Fll 28.) Prolem : Short nswer (8 points) The nswers to these prolems should e short nd not complicted. () If n NF M ccepts

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

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

First Midterm Examination

First Midterm Examination Çnky University Deprtment of Computer Engineering 203-204 Fll Semester First Midterm Exmintion ) Design DFA for ll strings over the lphet Σ = {,, c} in which there is no, no nd no cc. 2) Wht lnguge does

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

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Finite Automt Theory nd Forml Lnguges TMV027/DIT321 LP4 2018 Lecture 10 An Bove April 23rd 2018 Recp: Regulr Lnguges We cn convert between FA nd RE; Hence both FA nd RE ccept/generte regulr lnguges; More

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

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

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

XPath Node Selection over Grammar-Compressed Trees

XPath Node Selection over Grammar-Compressed Trees XPth Node Selection over Grmmr-Compressed Trees Sebstin Mneth University of Edinburgh with Tom Sebstin (INRIA Lille) XPth Node Selection Given: XPth query Q nd tree T Question: wc-time to evlute Q over

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

Data Structures (INE2011)

Data Structures (INE2011) Dt Strutures (INE2011) Eletronis nd Communition Engineering Hnyng University Hewoon Nm Leture 7 INE2011 Dt Strutures 1 Binry Tree Trversl Mny inry tree opertions re done y perorming trversl o the inry

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

Equivalent fractions have the same value but they have different denominators. This means they have been divided into a different number of parts.

Equivalent fractions have the same value but they have different denominators. This means they have been divided into a different number of parts. Frtions equivlent frtions Equivlent frtions hve the sme vlue ut they hve ifferent enomintors. This mens they hve een ivie into ifferent numer of prts. Use the wll to fin the equivlent frtions: Wht frtions

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

Lexical Analysis Finite Automate

Lexical Analysis Finite Automate Lexicl Anlysis Finite Automte CMPSC 470 Lecture 04 Topics: Deterministic Finite Automt (DFA) Nondeterministic Finite Automt (NFA) Regulr Expression NFA DFA A. Finite Automt (FA) FA re grph, like trnsition

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

CHAPTER 1 Regular Languages. Contents

CHAPTER 1 Regular Languages. Contents Finite Automt (FA or DFA) CHAPTE 1 egulr Lnguges Contents definitions, exmples, designing, regulr opertions Non-deterministic Finite Automt (NFA) definitions, euivlence of NFAs nd DFAs, closure under regulr

More information

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

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER LANGUAGES AND COMPUTATION ANSWERS The University of Nottinghm SCHOOL OF COMPUTER SCIENCE LEVEL 2 MODULE, SPRING SEMESTER 2016 2017 LNGUGES ND COMPUTTION NSWERS Time llowed TWO hours Cndidtes my complete the front cover of their nswer ook

More information

CS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions

CS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions CS 330 Forml Methods nd Models Dn Richrds, George Mson University, Spring 2016 Quiz Solutions Quiz 1, Propositionl Logic Dte: Ferury 9 1. (4pts) ((p q) (q r)) (p r), prove tutology using truth tles. p

More information

XML and Databases. Outline. Previous Lecture. XML Type Definition Languages. Sebastian Maneth NICTA and UNSW

XML and Databases. Outline. Previous Lecture. XML Type Definition Languages. Sebastian Maneth NICTA and UNSW Outline XML nd Dtses Lecture 5 XML Vlidtion using Automt Sestin Mneth NICA nd UNSW. Recp: deterministic Reg Expr s / Glushkov Automton. Complexity of DD vlidtion. Beyond DDs: XML Schem nd RELAX NG 4. Sttic

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

New data structures to reduce data size and search time

New data structures to reduce data size and search time New dt structures to reduce dt size nd serch time Tsuneo Kuwbr Deprtment of Informtion Sciences, Fculty of Science, Kngw University, Hirtsuk-shi, Jpn FIT2018 1D-1, No2, pp1-4 Copyright (c)2018 by The Institute

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

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton 25. Finite Automt AUTOMATA AND LANGUAGES A system of computtion tht only hs finite numer of possile sttes cn e modeled using finite utomton A finite utomton is often illustrted s stte digrm d d d. d q

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

Probability The Language of Chance P(A) Mathletics Instant Workbooks. Copyright

Probability The Language of Chance P(A) Mathletics Instant Workbooks. Copyright Proility The Lnguge of Chne Stuent Book - Series L-1 P(A) Mthletis Instnt Workooks Copyright Proility The Lnguge of Chne Stuent Book - Series L Contents Topis Topi 1 - Lnguge of proility Topi 2 - Smple

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

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

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

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

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

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

Algebra 2 Semester 1 Practice Final

Algebra 2 Semester 1 Practice Final Alger 2 Semester Prtie Finl Multiple Choie Ientify the hoie tht est ompletes the sttement or nswers the question. To whih set of numers oes the numer elong?. 2 5 integers rtionl numers irrtionl numers

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

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

Solving the Class Diagram Restructuring Transformation Case with FunnyQT

Solving the Class Diagram Restructuring Transformation Case with FunnyQT olving the lss Digrm Restruturing Trnsformtion se with FunnyQT Tssilo Horn horn@uni-kolenz.e Institute for oftwre Tehnology, University Kolenz-Lnu, Germny FunnyQT is moel querying n moel trnsformtion lirry

More information

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute Victor Admchik Dnny Sletor Gret Theoreticl Ides In Computer Science CS 5-25 Spring 2 Lecture 2 Mr 3, 2 Crnegie Mellon University Deterministic Finite Automt Finite Automt A mchine so simple tht you cn

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

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

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

Automata and Languages

Automata and Languages Automt nd Lnguges Prof. Mohmed Hmd Softwre Engineering Lb. The University of Aizu Jpn Grmmr Regulr Grmmr Context-free Grmmr Context-sensitive Grmmr Regulr Lnguges Context Free Lnguges Context Sensitive

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

Exam 1 Study Guide. Differentiation and Anti-differentiation Rules from Calculus I

Exam 1 Study Guide. Differentiation and Anti-differentiation Rules from Calculus I Exm Stuy Guie Mth 26 - Clulus II, Fll 205 The following is list of importnt onepts from eh setion tht will be teste on exm. This is not omplete list of the mteril tht you shoul know for the ourse, but

More information

Lesson 2.1 Inductive Reasoning

Lesson 2.1 Inductive Reasoning Lesson 2.1 Inutive Resoning Nme Perio Dte For Eerises 1 7, use inutive resoning to fin the net two terms in eh sequene. 1. 4, 8, 12, 16,, 2. 400, 200, 100, 50, 25,, 3. 1 8, 2 7, 1 2, 4, 5, 4. 5, 3, 2,

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

Harvard University Computer Science 121 Midterm October 23, 2012

Harvard University Computer Science 121 Midterm October 23, 2012 Hrvrd University Computer Science 121 Midterm Octoer 23, 2012 This is closed-ook exmintion. You my use ny result from lecture, Sipser, prolem sets, or section, s long s you quote it clerly. The lphet is

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

Nondeterminism. Nondeterministic Finite Automata. Example: Moves on a Chessboard. Nondeterminism (2) Example: Chessboard (2) Formal NFA

Nondeterminism. Nondeterministic Finite Automata. Example: Moves on a Chessboard. Nondeterminism (2) Example: Chessboard (2) Formal NFA Nondeterminism Nondeterministic Finite Automt Nondeterminism Subset Construction A nondeterministic finite utomton hs the bility to be in severl sttes t once. Trnsitions from stte on n input symbol cn

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

1.4 Nonregular Languages

1.4 Nonregular Languages 74 1.4 Nonregulr Lnguges The number of forml lnguges over ny lphbet (= decision/recognition problems) is uncountble On the other hnd, the number of regulr expressions (= strings) is countble Hence, ll

More information