XML and Databases. Sebastian Maneth NICTA and UNSW. Lecture 2 Memory Representations for XML: Space vs Access Speed. -- Semester 1, 2010

Size: px
Start display at page:

Download "XML and Databases. Sebastian Maneth NICTA and UNSW. Lecture 2 Memory Representations for XML: Space vs Access Speed. -- Semester 1, 2010"

Transcription

1 1 XML n Dtbses Leture 2 Memory Representtions for XML: Spe vs Aess Spee Sebstin Mneth NICTA n UNSW CSE@UNSW -- Semester 1, 2010

2 2 XML n Dtbses Leture 2 Memory Representtions for XML: Spe vs Aess Spee Sebstin Mneth NICTA n UNSW (toy: Kim Nguyen) CSE@UNSW -- Semester 1, 2010

3 Reminer 3 You n freely hoose to progrm your ssignments in C / C++ (xeres- librry not instlle on se, will be fixe shortly) Jv However, your oe must ompile with g / g++, jv, s instlle on CSE linux systems! Assignment 1 is ue Mony 23:59, 15 th of Mrh! Submit your oe using % give s4317 ss1 filenme.pp % give s4317 ss1 filenme.jv

4 4 Leture 2 XML into Memory

5 5 Problem with DOM Uses mssive mounts of memory. Even if pplition touhes only single element noe, the DOM API hs to mintin t struture tht represents the whole XML input oument. Exmple XML size DOM proess size x 2 81M 164M Text only, with one embring element 52M x M Treebnk, eep tree struture with short texts. Usully: more thn 10-times blow up!!

6 6 To remey the memory hunger of DOM Preproess (i.e., filter) the input XML oument to reue its overll size. Use n XPth/XSLT proessor to preselet interesting oument regions. CAVE: no uptes on the input XML oument re possible CAVE: mke sure the XPth/XSLT proessor is not implemente on top of DOM! Use ompletely ifferent pproh to XML proessing ( SAX) esign your own XML t struture n fill it with wht you nee

7 7 To remey the memory hunger of DOM Preproess (i.e., filter) the input XML oument to reue its overll size. Use n XPth/XSLT proessor to preselet interesting oument regions. CAVE: no uptes on the input XML oument re possible CAVE: mke sure the XPth/XSLT proessor is not implemente on top of DOM! Use ompletely ifferent pproh to XML proessing ( SAX) esign your own XML t struture n fill it with wht you nee

8 Outline 8 1. Tree Pointer Strutures 2. Binry Tree Enoings 3. Miniml Unique DAGs 4. How to use SAX

9 1. Tree pointer strutures 9 1. Consier binry trees Type Noe { lbel : String, : Noe, : Noe } book librry ollet.. How muh memory for n-noe binry tree?

10 1. Consier binry trees 1. Tree pointer strutures Type Noe { lbel : String, : Noe, : Noe }. book librry my_tree ollet. 10 How muh memory for n-noe binry tree? r1: librry0 r2: book0 length(lbel_1) length(lbel_2) length(lbel_n) +1 my_tree: r1 tr1 tr2 tr1: r2 tr3 tr4 3 * length(pointer) * n

11 1. Consier binry trees 1. Tree pointer strutures Type Noe { lbel : String, : Noe, : Noe }. book librry my_tree ollet. 11 How muh memory for n-noe binry tree? r1: librry0 r2: book0 length(lbel_1) length(lbel_2) length(lbel_n) +1 my_tree: r1 tr1 tr2 tr1: r2 tr3 tr4 3 * length(pointer) * n typil: 4 bytes

12 1. Consier binry trees Tree pointer strutures Type Noe { lbel : String, : Noe, : Noe }. book librry my_tree ollet. 12 How muh memory for n-noe binry tree? Whtever is neee for the lbels PLUS 12 bytes per noe. length(lbel_1) length(lbel_2) length(lbel_n) +1 3 * length(pointer) * n typil: 4 bytes

13 1. Consier binry trees Tree pointer strutures Type Noe { lbel : String, : Noe, : Noe }. book librry my_tree ollet. 13 How muh memory for n-noe binry tree? Whtever is neee for the lbels PLUS 12 bytes per noe. Cn esily be optimize: E.g., store eh istint string only one! length(lbel_1) length(lbel_2) length(lbel_n) +1 3 * length(pointer) * n typil: 4 bytes

14 1. Consier binry trees Tree pointer strutures Type Noe { lbel : String, : Noe, : Noe }. book librry my_tree ollet. 14 Seriliztion to XML <librry><book>< > </book></librry> ^ ^ ^^ ^ #hrters per noe: * Length(lbel) E.g., one noe w. 4-hrter ASCII lbel: 13 bytes (ssuming UTF-8!)

15 1. Consier binry trees Tree pointer strutures Byte Type Noe { lbel : String, : Noe, : Noe }. book librry my_tree ollet. 15 Often #istint noe lbels is smll, 100. Fits in one Byte Then, only 9 bytes per noe. MEM(n-noe binry tree pointer stru, 256 lbels) = SIZE(n-noe binry tree in XML, verge lbel length=2) #hrters per noe: * Length(lbel) One noe w. 2-hrter ASCI lbel: 9 bytes (ssuming UTF-8!)

16 Tree pointer strutures my_tree 16 Nie Following pointers is fst! muh higher ess spee! (thn on o seen s string..) E.g. t root, get -hil. book librry ollet.. Often #istint noe lbels is smll, 100. Fits in one Byte Then, only 9 bytes per noe. MEM(n-noe binry tree pointer stru, 256 lbels) = SIZE(n-noe binry tree in XML, verge lbel length=2) #hrters per noe: * Length(lbel) One noe w. 2-hrter ASCI lbel: 9 bytes (ssuming UTF-8!)

17 Tree pointer strutures Consier binry trees Plin no ttributes, no text noes, librry Question Using (top-own) pointer struture, s the one bove, how n you implement DOM interfe? Noe noenme : DOMString prentnoe : Noe firstchil : Noe most hil nextsibling : Noe returns NULL for root elem hilnoes : NoeList

18 Tree pointer strutures Consier binry trees Plin no ttributes, no text noes, librry Question Using (top-own) pointer struture, s the one bove, how n you implement DOM interfe? Noe noenme : DOMString prentnoe : Noe firstchil : Noe most hil nextsibling : Noe returns NULL for root elem hilnoes : NoeList At run-time noe is represente s pointer, PLUS stk of pointers of ll its nestors. (Noe, [prent(noe)::prent(prent(noe)):: ::root-noe])

19 Tree pointer strutures Aess spee of prentnoe shoul be pprox sme, s in ntive DOM. Wht bout ess spee of nextsibling? 19 Wht is the run-time size of our binry DOM-tree t struture? (WC/verge) Question Using (top-own) pointer struture, s the one bove, how n you implement DOM interfe? Noe noenme : DOMString prentnoe : Noe firstchil : Noe most hil nextsibling : Noe returns NULL for root elem hilnoes : NoeList At run-time noe is represente s pointer, PLUS stk of pointers of ll its nestors. (Noe, [prent(noe)::prent(prent(noe)):: ::root-noe])

20 interfe Noe { // NoeType onst unsigne short ELEMENT_NODE = 1; onst unsigne short ATTRIBUTE_NODE = 2; onst unsigne short TEXT_NODE = 3; onst unsigne short CDATA_SECTION_NODE = 4; onst unsigne short ENTITY_REFERENCE_NODE = 5; onst unsigne short ENTITY_NODE = 6; onst unsigne short PROCESSING_INSTRUCTION_NODE = 7; onst unsigne short COMMENT_NODE = 8; onst unsigne short DOCUMENT_NODE = 9; onst unsigne short DOCUMENT_TYPE_NODE = 10; onst unsigne short DOCUMENT_FRAGMENT_NODE = 11; onst unsigne short NOTATION_NODE = 12; reonly ttribute DOMString noenme; ttribute DOMString noevlue; // rises(domexeption) on setting // rises(domexeption) on retrievl reonly ttribute unsigne short noetype; reonly ttribute Noe prentnoe; reonly ttribute NoeList hilnoes; reonly ttribute Noe firstchil; reonly ttribute Noe lstchil; reonly ttribute Noe previoussibling; reonly ttribute Noe nextsibling; reonly ttribute NmeNoeMp ttributes; reonly ttribute Doument ownerdoument; Noe insertbefore(in Noe newchil, in Noe refchil) rises(domexeption); Noe replechil(in Noe newchil, in Noe olchil) rises(domexeption); Noe removechil(in Noe olchil) rises(domexeption); Noe ppenchil(in Noe newchil) rises(domexeption); boolen hschilnoes(); Noe lonenoe(in boolen eep); }; 20

21 Tree pointer strutures 21 To slsh memory hunger (of, e.g., DOM ) LESSON 1 Avoi ll bkwr pointers (buil them online, ynmilly) binry trees DOM book librry NIL firstchil &prent firstchil &prent librry book n&psibling hilnoes hilnoes lstchil &prent ollet.

22 Tree pointer strutures Consier binry trees Type Noe { lbel : String, : Noe, : Noe } book librry ollet. How muh memory for n-noe binry tree? How to ttributes n text noes? Text: n be in the lbel, strting with speil hrter (pb: 2 unuse pointers) Attributes: pointer to n ux. Dt-Struture (expensive) Attributes enoe s hilren with speil lbels...

23 Tree pointer strutures Consier unrnke trees firstchil librry lstchil book book book book unrnke = no priori boun on #hilren of noe. Tree struture of XML: unrnke trees! (not binry) Type Noe { lbel : String, hilren : List[Noe] }

24 Tree pointer strutures Consier unrnke trees firstchil librry lstchil book book book book unrnke = no priori boun on #hilren of noe. Tree struture of XML: unrnke trees! (not binry) Type Noe { lbel : String, hilren : List[Noe] } How muh memory for List[Noe] of n noes?

25 Tree pointer strutures Consier unrnke trees firstchil librry lstchil book book book book unrnke = no priori boun on #hilren of noe. Tree struture of XML: unrnke trees! Typilly Type Noe { lbel : String, hilren : List[Noe] } N1 next N2 How muh memory for List[Noe] of n noes?

26 Tree pointer strutures Consier unrnke trees firstchil librry lstchil book book book book unrnke = no priori boun on #hilren of noe. Tree struture of XML: unrnke trees! Typilly Type Noe { lbel : String, hilren : List[Noe] } N1 next N2 How muh memory for List[Noe] of n noes? 2*n pointers

27 Tree pointer strutures Consier unrnke trees In this wy, noe of binry tree nees 5 pointers (plus lbel info/pointer..) unrnke = no priori boun on #hilren of noe. Tree struture of XML: unrnke trees! Typilly Type Noe { lbel : String, hilren : List[Noe] } N1 next N2 How muh memory for List[Noe] of n noes? 2*n pointers

28 Tree pointer strutures Consier unrnke trees In this wy, noe of binry tree nees 5 pointers (plus lbel info/pointer..) More effiient possibilities: (1) Use rrys. Store #hilren. n pointers + (log n) bits (2) Enoe tree s binry tree. Typilly Length of the rry Type Noe { lbel : String, hilren : List[Noe] } N1 next N2 How muh memory for List[Noe] of n noes? 2*n pointers

29 Tree pointer strutures Consier unrnke trees In this wy, noe of binry tree nees 5 pointers (plus lbel info/pointer..) More effiient possibilities: (1) Use rrys. Store #hilren. (2) Enoe tree s binry tree. n pointers + (log ) Bits Typilly Type Noe { lbel : String, hilren : List[Noe] } N1 next N2 How muh memory for List[Noe] of n noes? 2*n pointers

30 2. Binry Tree Enoings 30 Any unrnke tree n be enoe s binry tree. Populr enoing: firstchil/nextsibling enoing. The firstchil beomes the pointer The nextsibling beomes the pointer firstchil N1 N2 N3 N4 N5 N6 N7 N8 N9 N10

31 2. Binry Tree Enoings 31 Any unrnke tree n be enoe s binry tree. Populr enoing: firstchil/nextsibling enoing. The firstchil beomes the pointer The nextsibling beomes the pointer firstchil N1 N1 N2 N3 N4 N5 N2 N3 N4 N5 N6 N7 N8 N6 N7 N8 N9 N10 N9 N10

32 2. Binry Tree Enoings 32 Any unrnke tree n be enoe s binry tree. Populr enoing: firstchil/nextsibling enoing. The firstchil beomes the pointer The nextsibling beomes the pointer firstchil N1 N1 N2 N3 N4 N5 N2 N3 N4 N5 N6 N7 N8 N6 N7 N8 N9 N10 N9 N10

33 2. Binry Tree Enoings 33 Any unrnke tree n be enoe s binry tree. Populr enoing: firstchil/nextsibling enoing. The firstchil beomes the pointer The nextsibling beomes the pointer firstchil N1 N1 N2 N3 N4 N5 N2 N3 N4 N5 N6 N7 N8 N6 N7 N8 N9 N10 N9 N10

34 2. Binry Tree Enoings 34 Any unrnke tree n be enoe s binry tree. Populr enoing: firstchil/nextsibling enoing. The firstchil beomes the pointer The nextsibling beomes the pointer N1 firstchil N1 N2 N3 N2 N3 N4 N5 N6 N4 N6 N7 N8 N9 N7 N8 N5 N9 N10 N10

35 Binry Tree Enoings 35 Any unrnke tree n be enoe s binry tree. Populr enoing: firstchil/nextsibling enoing. The firstchil beomes the pointer The nextsibling beomes the pointer firstchil N1 NIL N2 N3 N1 NIL N2 N3 N4 N5 N6 N7 N8 NIL N9 N6 N7 NIL N8 N4 NIL N5 NIL N9 N10 NIL N10 NIL NIL

36 Binry Tree Enoings 36 Any unrnke tree n be enoe s binry tree. n-noe unrnke tree firstchil/nextsibling enoing eoing n-noe binry tree Questions Time overhe for simulting lstchil ess, on the binry enoing? Cn you think of other binry tree enoings? How to simulte previous-sibling?

37 Binry Tree Enoings 37 Any unrnke tree n be enoe s binry tree. n-noe unrnke tree firstchil/nextsibling enoing eoing n-noe binry tree Goo Property of the firstchil/nextsibling enoing: XML types (e.g., DTD, XML Shem, Relx NG) re preserve when going from unrnke to binry (n vie vers).

38 Binry Tree Enoings 38 Any unrnke tree n be enoe s binry tree. n-noe unrnke tree firstchil/nextsibling enoing eoing n-noe binry tree Goo Property of the firstchil/nextsibling enoing: XML types (e.g., DTD, XML Shem, Relx NG) re preserve when going from unrnke to binry (n vie vers). LESSON 2 ginst memory hunger Use binry trees inste of unrnke trees. ( or use effiient rrys) + Fst hil-m ess - Expensive to upte (insert/elete)

39 Tree Pointer Strutures 39 Question Give ttype for binry trees whih stores only non-nil pointers. Then, n-noe tree: <n pointers Type Noe { lbel : String, : Noe, : Noe }

40 Type Noe { lbel : Byte, : Noe, : Noe } 3. Miniml Unique DAGs binry tree 2 pointers per noe 40 L1: no bkwr pointers L2: use binry trees or effiient rrys Cn we o with even less pointers?

41 Type Noe { lbel : Byte, : Noe, : Noe } 3. Miniml Unique DAGs binry tree 2 pointers per noe 41 L1: no bkwr pointers L2: use binry trees or effiient rrys Cn we o with even less pointers? n-noe tree: 2n pointers

42 3. Miniml Unique DAGs 42 Type Noe { lbel : Byte, : Noe, : Noe } binry tree 2 pointers per noe Cn we o with even less pointers? n-noe tree: 2n pointers YES! Direte Ayli Grph DAG shre ientil subtrees

43 3. Miniml Unique DAGs 43 Type Noe { lbel : Byte, : Noe, : Noe } binry tree 2 pointers per noe 18 pointers relly mens 18 non-nil pointers Cn we o with even less pointers? n-noe tree: 2n pointers YES! Direte Ayli Grph DAG shre ientil subtrees 18/19 pointers/noes 10/6 pointers/noes

44 3. Miniml Unique DAGs 44 A DAG representtion of tree hs lwys Less thn or equl #noes thn the tree Less thn or equl #pointers thn the tree.

45 3. Miniml Unique DAGs 45

46 3. Miniml Unique DAGs 46

47 3. Miniml Unique DAGs 47 (miniml) DAGs hve mny pplitions! CSE (Common Subexpression Elimintion) for effiient evlution of expressions (o term grph rewriting, inste of term rewriting) Moel heking with BDDs Binry Deision Digrms for effiient evlution of logi formuls Effiient XML query evlution

48 3. Miniml Unique DAGs 48 (miniml) DAGs hve mny pplitions! CSE (Common Subexpression Elimintion) for effiient evlution of expressions (o term grph rewriting, inste of term rewriting) Moel heking with BDDs Binry Deision Digrms for effiient evlution of logi formuls Effiient XML query evlution Btw, insie of DAG, you hve referentil ompleteness struturl equlity = equlity of pointers

49 3. Miniml Unique DAGs 49 Every tree hs miniml, unique DAG! The DAG is t most exponentilly smller thn the tree. Builing the miniml unique DAG is esy! Cn be one in (mortize) liner time.

50 3. Miniml Unique DAGs 50 Every tree hs miniml, unique DAG! The DAG is t most exponentilly smller thn the tree. Builing the miniml unique DAG is esy! Cn be one in (mortize) liner time. How?

51 3. Miniml Unique DAGs 51 Every tree hs miniml, unique DAG! The DAG is t most exponentilly smller thn the tree. Builing the miniml unique DAG is esy! Cn be one in (mortize) liner time. How? (even while prsing) Buil hsh tble of ll subtrees seen so fr (we on t wnt to ompre mny trees, noe by noe, lter on..) Question Give simple hsh funtion tht works for the tree bove.

52 3. Miniml Unique DAGs 52 Hsh Tble HT Hsh funtion f 1 2 (,), ((,),) 3 (b,) hsh buket We wnt f istributes trees uniformly into bukets test if tree T is in HT, time O( size(t) ) Question Give simple hsh funtion tht works for the tree bove.

53 Miniml Unique DAGs 53 1: bib [2,3,4,5] 2: book [6,7] 3: rtile [8,9] 4: book [10,11] 5: rtile [12,13] 6: uthor 7: title 8: uthor 9: title 10:prie 11:title 12:prie 13:title <bib> <book> <uthor></uthor> <title></title> </book> <rtile> <uthor></uthor> <title></title> </rtile> <book> <prie></prie> <title></title> </book> <rtile> <prie></prie> <title></title> </rtile> </book>

54 Miniml Unique DAGs 54 1: bib [2,3,4,5] 2: book [6,7] 3: rtile [8,9] 4: book [10,11] 5: rtile [12,13] 6: uthor 7: title 8: uthor 9: title 10:prie 11:title 12:prie 13:title 6 <bib> <book> <uthor></uthor> <title></title> </book> <rtile> <uthor></uthor> <title></title> </rtile> <book> <prie></prie> <title></title> </book> <rtile> <prie></prie> <title></title> </rtile> </book>

55 Miniml Unique DAGs 55 1: bib [2,3,4,5] 2: book [6,7] 3: rtile [8,9] 4: book [10,11] 5: rtile [12,13] 6: uthor 7: title 8: uthor 9: title 10:prie 11:title 12:prie 13:title 7 6 <bib> <book> <uthor></uthor> <title></title> </book> <rtile> <uthor></uthor> <title></title> </rtile> <book> <prie></prie> <title></title> </book> <rtile> <prie></prie> <title></title> </rtile> </book>

56 Miniml Unique DAGs 56 1: bib [2,3,4,5] 2: book [6,7] 3: rtile [8,9] 4: book [10,11] 5: rtile [12,13] 6: uthor 7: title 10 8: uthor 9: title 10:prie 11:title 12:prie 13:title 7 6 <bib> <book> <uthor></uthor> <title></title> </book> <rtile> <uthor></uthor> <title></title> </rtile> <book> <prie></prie> <title></title> </book> <rtile> <prie></prie> <title></title> </rtile> </book>

57 Miniml Unique DAGs 57 1: bib [2,3,4,5] 2: book [6,7] 3: rtile [8,9] 4: book [10,11] 5: rtile [12,13] 6: uthor 7: title 10 8: uthor 9: title 10:prie 11:title 12:prie 13:title 7 6 <bib> <book> <uthor></uthor> <title></title> </book> <rtile> <uthor></uthor> <title></title> </rtile> <book> <prie></prie> <title></title> </book> <rtile> <prie></prie> <title></title> </rtile> </book> miniml unique DAG 8 noes (vs 13 noes in the originl tree)

58 Miniml Unique DAGs 58 Exmple Prse & DAGify 1: strtelement() hsh ontent

59 Miniml Unique DAGs 59 Exmple Prse & DAGify 1: strtelement() 2: strtelement() hsh ontent

60 Miniml Unique DAGs 60 Exmple Prse & DAGify 1: strtelement() 2: strtelement() 3: strtelement() hsh ontent

61 Miniml Unique DAGs 61 Exmple Prse & DAGify 1: strtelement() 2: strtelement() 3: strtelement() 4: enelement() 1. p1=hsht.fin() 2. if(p1==null) { p1=new( -noe,null,null) hsht.insert(p1) } hsh ontent

62 Miniml Unique DAGs 62 Exmple Prse & DAGify 1: strtelement() 2: strtelement() 3: strtelement() 4: enelement() 1. p1=hsht.fin() 2. if(p1==null) { p1=new( -noe,null,null) hsht.insert(p1) } hsh ontent 1 2 p1 Memory lotion p1 is DAG with root noe, n hil1-pointer=null hil2-pointer=null

63 Miniml Unique DAGs 63 Exmple Prse & DAGify 1: strtelement() 2: strtelement() 3: strtelement() 4: enelement() 1. p1=hsht.fin() 2. if(p1==null) { p1=new( -noe,null,null) hsht.insert(p1) } must store hilren lists: [ [],[p1] ] hilren of root noe (so fr, none) hilren of - noe (so fr, one) hsh ontent 1 2 p1 Memory lotion p1 is DAG with root noe, n hil1-pointer=null hil2-pointer=null

64 Miniml Unique DAGs 64 Exmple Prse & DAGify 1: strtelement() 2: strtelement() 3: strtelement() 4: enelement() 5: strtelement() hsh ontent 1 2 p1

65 Miniml Unique DAGs 65 Exmple Prse & DAGify 1: strtelement() 2: strtelement() 3: strtelement() 4: enelement() 5: strtelement() 6: enelement() 1. p2=hsht.fin() 2. if(p2==null) { p2=new( -noe,null,null) hsht.insert(p2) } hsh ontent 1 2 p1

66 Miniml Unique DAGs 66 Exmple Prse & DAGify 1: strtelement() 2: strtelement() 3: strtelement() 4: enelement() 5: strtelement() 6: enelement() 1. p2=hsht.fin()=p1 2. if(p2==null) { p2=new( -noe,null,null) hsht.insert(p2) } hsh ontent 1 2 p1

67 Miniml Unique DAGs 67 Exmple Prse & DAGify 1: strtelement() 2: strtelement() 3: strtelement() 4: enelement() 5: strtelement() 6: enelement() 1. p2=hsht.fin()=p1 2. if(p2==null) { p2=new( -noe,null,null) hsht.insert(p2) } store hilren lists: [ [],[p1,p1] ] hsh ontent 1 2 p1

68 Miniml Unique DAGs 68 Exmple Prse & DAGify 1: strtelement() 2: strtelement() 3: strtelement() 4: enelement() 5: strtelement() 6: enelement() 7: enelement() store hilren lists: [ [],[p1,p1] ] hsh ontent 1 2 p1

69 Miniml Unique DAGs 69 Exmple Prse & DAGify 1: strtelement() 2: strtelement() 3: strtelement() 4: enelement() 5: strtelement() 6: enelement() 7: enelement() p1 1. p=hsht.fin() 2. if(p==null) { p=new( -noe,p1,p1) hsht.insert(p) } p1 store hilren lists: [ [],[p1,p1] ] hsh ontent 1 2 p p use hilren list!! Memory lotion p is DAG with root noe, n hil1-pointer=p1 hil2-pointer=p1

70 Miniml Unique DAGs 70 Exmple Prse & DAGify 1: strtelement() 2: strtelement() 3: strtelement() 4: enelement() 5: strtelement() 6: enelement() 7: enelement() p1 1. p=hsht.fin() 2. if(p==null) { p=new( -noe,p1,p1) hsht.insert(p) } p1 store hilren lists: [ [],[p1,p1] ] p (s lst) hsh now upte!! ontent 1 2 p p Memory lotion p is DAG with root noe, n hil1-pointer=p1 hil2-pointer=p1

71 Miniml Unique DAGs 71 Exmple Prse & DAGify New hilren lists: [ [p] ] 1: strtelement() 2: strtelement() 3: strtelement() 4: enelement() 5: strtelement() 6: enelement() 7: enelement() hilren of root noe (so fr, one) 1. p=hsht.fin() 2. if(p==null) { p=new( -noe,p1,p1) hsht.insert(p) } store hilren lists: [ [],[p1,p1] ] p (s lst) hsh now upte!! ontent 1 2 p p Memory lotion p is DAG with root noe, n hil1-pointer=p1 hil2-pointer=p1

72 Miniml Unique DAGs 72 Exmple Prse & DAGify New hilren lists: [ [p] ] 1: strtelement() 2: strtelement() 3: strtelement() 4: enelement() 5: strtelement() 6: enelement() 7: enelement() hilren of root noe (so fr, one) 1. p=hsht.fin() 2. if(p==null) { p=new( -noe,p1,p1) hsht.insert(p) } hsh ontent 1 2 p p Assume 100 element nmes Exmple hsh funtion: (#elementnme * #elementnme(1 st hil) * 100 * #elemnme(2 n hil) + 100^3 * elemnme(1 st hil of 1 st h.) + ) MOD sizeof(hsht)

73 Miniml Unique DAGs 73 DOM interft to the DAG? prentnoe / p&nsibling s before Uptes n be expensive (opying!) How to tth ttribute & text noes to the DAG?

74 Miniml Unique DAGs 74 DOM interft to the DAG? prentnoe / p&nsibling s before Uptes n be expensive (opying!) How to tth ttribute & text noes to the DAG? Store them seprtely in tble. Inex by e.g., Noe number (in o-orer) or number of tr/text noes Store inex in eh DAG noe / or ompute it online. (pre-trversl)

75 Miniml Unique DAGs 75 Wht bout unrnke, vs binry DAGs? librry firstchil lstchil book book book book More preisely, Wht bout size of miniml-unique-unrnke-dag( Tree ) vs size of miniml-unique-binry-dag( fcns-en( Tree ) ) firstchil/nextsibling

76 Miniml Unique DAGs 76 size of miniml-unique-unrnke-dag( Tree ) vs size of miniml-unique-binry-dag( fcns-en( Tree ) ) Questions Give tree for whih first is smller thn the seon. Give tree for whih the seon is smller thn the first.

77 Unrnke vs Binry Trees 77 18/19 3/4 p n s p n s p n s p n s p n s p n s Min. DAG p 6 n s p p p p p p Min. DAG p p 1 p 13/9 n s n s n s n s n s n s p n s p p

78 Unrnke vs Binry Trees 78 18/19 3/4 p n s p n s p n s p n s p n s p n s Min. DAG p 6 n s Cn it be vi vers? (min bin. DAG is smller) YES!! Hs 18 eges DAG of bin.oing only 12 eges u p p p x b b y b b z b b DAG ompression is sensible to rnk/unrnkeness!

79 Unrnke vs Binry Trees 79 Lst omment on binry tree enoings / DAGs YES: the binry trees beome very regulr (eep, to the ) Items (books/resses/et) DAG Items (books/resses/et) DAG w. multipliities Items (books/resses/et) Bin tree w multipliities

80 3. Miniml Unique DAGs 80

81 Effiient XML & Binry XML 81 W3C working groups XML Binry Chrteriztion Working Group The Figure on the next slie is from the EXI Mesurement Note -- new version of the note me out 25 July 2007!)

82 Effiient XML & Binry XML 82 W3C working groups XML Binry Chrteriztion Working Group ene in 2008, merge with the following: Effiient XML Interhnge Working Group (EXI) The Figure on the next slie is from the EXI Mesurement Note -- new version of the note me out 25 July 2007!)

83 83

84 Miniml Unique DAGs 84 Assignment 2 buil miniml DAG for tree (given in XML) For simpliity, ignore ttributes n text vlues. only onsier element noes. Buil the DAG, while prsing the XML! Construt hsh tble whih stores ll (omplete) istint subtrees seen so fr. Clery, we o not wnt to prse into DOM, n then pull things out of there. Inste, we nee more flexible prser tht gives s the freeom of wht extly to store, n how.

85 How to use SAX 85 Remember one of the promises of XML You never nee to write prser gin!

86 How to use SAX 86 Remember one of the promises of XML You never nee to write prser gin! but, of ourse if you wnt to buil up your own (e.g. memory-effiient) t struture, you nee to tlk to the prser. You wnt the prser to Give low level ess to the t: Brket by brket, text-noe by text-noe. In oument orer.

87 How to use SAX 87 Remember one of the promises of XML You never nee to write prser gin! but, of ourse if you wnt to buil up your own (e.g. memory-effiient) t struture, you nee to tlk to the prser. You wnt the prser to Give low level ess to the t: Brket by brket, text-noe by text-noe. In oument orer. SAX

88 88

89 89

90 90

91 91

92 92

93 93

94 94

95 95 Deline: 29 th Mrh For Assignment 2, you only nee to register strtelement n enelement. In tht wy, you utomtilly reeive only element noes.. Of ourse you n use SAX for other things thn builing up t struture. E.g. nswer pth queries while prsing (on strem ) (low memory onsumption!)

96 96 END Leture 2

XML and Databases. Outline. XPath. Outline - Lectures. XPath Data Model. Outline - Assignments. XPath. Sebastian Maneth NICTA and UNSW

XML and Databases. Outline. XPath. Outline - Lectures. XPath Data Model. Outline - Assignments. XPath. Sebastian Maneth NICTA and UNSW Outline XML n Dtses Leture 6 Noe Seleting Queries: XPth 1.0 1. XPth Dt Moel: 7 types of noes 2. Simple Exmples 3. Lotion Steps n Pths 4. Vlue Comprison, n Other Funtions Sestin Mneth NICTA n UNSW CSE@UNSW

More information

CS453 INTRODUCTION TO DATAFLOW ANALYSIS

CS453 INTRODUCTION TO DATAFLOW ANALYSIS CS453 INTRODUCTION TO DATAFLOW ANALYSIS CS453 Leture Register llotion using liveness nlysis 1 Introdution to Dt-flow nlysis Lst Time Register llotion for expression trees nd lol nd prm vrs Tody Register

More information

Paradigm 5. Data Structure. Suffix trees. What is a suffix tree? Suffix tree. Simple applications. Simple applications. Algorithms

Paradigm 5. Data Structure. Suffix trees. What is a suffix tree? Suffix tree. Simple applications. Simple applications. Algorithms Prdigm. Dt Struture Known exmples: link tble, hep, Our leture: suffix tree Will involve mortize method tht will be stressed shortly in this ourse Suffix trees Wht is suffix tree? Simple pplitions History

More information

CS553 Lecture Introduction to Data-flow Analysis 1

CS553 Lecture Introduction to Data-flow Analysis 1 ! Ide Introdution to Dt-flow nlysis!lst Time! Implementing Mrk nd Sweep GC!Tody! Control flow grphs! Liveness nlysis! Register llotion CS553 Leture Introdution to Dt-flow Anlysis 1 Dt-flow Anlysis! Dt-flow

More information

CMPUT101 Introduction to Computing - Summer 2002

CMPUT101 Introduction to Computing - Summer 2002 CMPUT Introdution to Computing - Summer 22 %XLOGLQJ&RPSXWHU&LUFXLWV Chpter 4.4 3XUSRVH We hve looked t so fr how to uild logi gtes from trnsistors. Next we will look t how to uild iruits from logi gtes,

More information

Class Overview. Database Design. Database Design Process. Database Design. Introduction to Data Management CSE 414

Class Overview. Database Design. Database Design Process. Database Design. Introduction to Data Management CSE 414 Introution to Dt Mngement CSE 44 Unit 6: Coneptul Design E/R Digrms Integrity Constrints BCNF Introution to Dt Mngement CSE 44 E/R Digrms ( letures) CSE 44 Autumn 08 Clss Overview Dtse Design Unit : Intro

More information

Greedy Algorithm. Algorithm Fall Semester

Greedy Algorithm. Algorithm Fall Semester Greey Algorithm Algorithm 0 Fll Semester Optimiztion prolems An optimiztion prolem is one in whih you wnt to fin, not just solution, ut the est solution A greey lgorithm sometimes works well for optimiztion

More information

Distance vector protocol

Distance vector protocol istne vetor protool Irene Finohi finohi@i.unirom.it Routing Routing protool Gol: etermine goo pth (sequene of routers) thru network from soure to Grph strtion for routing lgorithms: grph noes re routers

More information

Containers: Queue and List

Containers: Queue and List Continers: Queue n List Queue A ontiner in whih insertion is one t one en (the til) n eletion is one t the other en (the he). Also lle FIFO (First-In, First-Out) Jori Cortell n Jori Petit Deprtment of

More information

V = set of vertices (vertex / node) E = set of edges (v, w) (v, w in V)

V = set of vertices (vertex / node) E = set of edges (v, w) (v, w in V) Definitions G = (V, E) V = set of verties (vertex / noe) E = set of eges (v, w) (v, w in V) (v, w) orere => irete grph (igrph) (v, w) non-orere => unirete grph igrph: w is jent to v if there is n ege from

More information

CS 551 Computer Graphics. Hidden Surface Elimination. Z-Buffering. Basic idea: Hidden Surface Removal

CS 551 Computer Graphics. Hidden Surface Elimination. Z-Buffering. Basic idea: Hidden Surface Removal CS 55 Computer Grphis Hidden Surfe Removl Hidden Surfe Elimintion Ojet preision lgorithms: determine whih ojets re in front of others Uses the Pinter s lgorithm drw visile surfes from k (frthest) to front

More information

Chapter 9. Greedy Technique. Copyright 2007 Pearson Addison-Wesley. All rights reserved.

Chapter 9. Greedy Technique. Copyright 2007 Pearson Addison-Wesley. All rights reserved. Chpter 9 Greey Tehnique Copyright 2007 Person Aison-Wesley. All rights reserve. Greey Tehnique Construts solution to n optimiztion prolem piee y piee through sequene of hoies tht re: fesile lolly optiml

More information

CS 241 Week 4 Tutorial Solutions

CS 241 Week 4 Tutorial Solutions CS 4 Week 4 Tutoril Solutions Writing n Assemler, Prt & Regulr Lnguges Prt Winter 8 Assemling instrutions utomtilly. slt $d, $s, $t. Solution: $d, $s, nd $t ll fit in -it signed integers sine they re 5-it

More information

COMPUTER EDUCATION TECHNIQUES, INC. (XML ) SA:

COMPUTER EDUCATION TECHNIQUES, INC. (XML ) SA: In orer to lern whih questions hve een nswere orretly: 1. Print these pges. 2. Answer the questions. 3. Sen this ssessment with the nswers vi:. FAX to (212) 967-3498. Or. Mil the nswers to the following

More information

ECE 468/573 Midterm 1 September 28, 2012

ECE 468/573 Midterm 1 September 28, 2012 ECE 468/573 Midterm 1 September 28, 2012 Nme:! Purdue emil:! Plese sign the following: I ffirm tht the nswers given on this test re mine nd mine lone. I did not receive help from ny person or mteril (other

More information

Minimal Memory Abstractions

Minimal Memory Abstractions Miniml Memory Astrtions (As implemented for BioWre Corp ) Nthn Sturtevnt University of Alert GAMES Group Ferury, 7 Tlk Overview Prt I: Building Astrtions Minimizing memory requirements Performnes mesures

More information

Outline. CS38 Introduction to Algorithms. Graphs. Graphs. Graphs. Graph traversals

Outline. CS38 Introduction to Algorithms. Graphs. Graphs. Graphs. Graph traversals Outline CS38 Introution to Algorithms Leture 2 April 3, 2014 grph trversls (BFS, DFS) onnetivity topologil sort strongly onnete omponents heps n hepsort greey lgorithms April 3, 2014 CS38 Leture 2 2 Grphs

More information

CS201 Discussion 10 DRAWTREE + TRIES

CS201 Discussion 10 DRAWTREE + TRIES CS201 Discussion 10 DRAWTREE + TRIES DrwTree First instinct: recursion As very generic structure, we could tckle this problem s follows: drw(): Find the root drw(root) drw(root): Write the line for the

More information

Unit #9 : Definite Integral Properties, Fundamental Theorem of Calculus

Unit #9 : Definite Integral Properties, Fundamental Theorem of Calculus Unit #9 : Definite Integrl Properties, Fundmentl Theorem of Clculus Gols: Identify properties of definite integrls Define odd nd even functions, nd reltionship to integrl vlues Introduce the Fundmentl

More information

Introduction. Example

Introduction. Example OMS0 Introution isjoint sets n minimum spnning trees In this leture we will strt by isussing t struture use for mintining isjoint subsets of some bigger set. This hs number of pplitions, inluing to mintining

More information

10.2 Graph Terminology and Special Types of Graphs

10.2 Graph Terminology and Special Types of Graphs 10.2 Grph Terminology n Speil Types of Grphs Definition 1. Two verties u n v in n unirete grph G re lle jent (or neighors) in G iff u n v re enpoints of n ege e of G. Suh n ege e is lle inient with the

More information

Lecture 8: Graph-theoretic problems (again)

Lecture 8: Graph-theoretic problems (again) COMP36111: Advned Algorithms I Leture 8: Grph-theoreti prolems (gin) In Prtt-Hrtmnn Room KB2.38: emil: iprtt@s.mn..uk 2017 18 Reding for this leture: Sipser: Chpter 7. A grph is pir G = (V, E), where V

More information

CMSC 331 First Midterm Exam

CMSC 331 First Midterm Exam 0 00/ 1 20/ 2 05/ 3 15/ 4 15/ 5 15/ 6 20/ 7 30/ 8 30/ 150/ 331 First Midterm Exm 7 October 2003 CMC 331 First Midterm Exm Nme: mple Answers tudent ID#: You will hve seventy-five (75) minutes to complete

More information

UTMC APPLICATION NOTE UT1553B BCRT TO INTERFACE PSEUDO-DUAL-PORT RAM ARCHITECTURE INTRODUCTION ARBITRATION DETAILS DESIGN SELECTIONS

UTMC APPLICATION NOTE UT1553B BCRT TO INTERFACE PSEUDO-DUAL-PORT RAM ARCHITECTURE INTRODUCTION ARBITRATION DETAILS DESIGN SELECTIONS UTMC APPLICATION NOTE UT1553B BCRT TO 80186 INTERFACE INTRODUCTION The UTMC UT1553B BCRT is monolithi CMOS integrte iruit tht provies omprehensive Bus Controller n Remote Terminl funtions for MIL-STD-

More information

COMP 423 lecture 11 Jan. 28, 2008

COMP 423 lecture 11 Jan. 28, 2008 COMP 423 lecture 11 Jn. 28, 2008 Up to now, we hve looked t how some symols in n lphet occur more frequently thn others nd how we cn sve its y using code such tht the codewords for more frequently occuring

More information

If you are at the university, either physically or via the VPN, you can download the chapters of this book as PDFs.

If you are at the university, either physically or via the VPN, you can download the chapters of this book as PDFs. Lecture 5 Wlks, Trils, Pths nd Connectedness Reding: Some of the mteril in this lecture comes from Section 1.2 of Dieter Jungnickel (2008), Grphs, Networks nd Algorithms, 3rd edition, which is ville online

More information

Introduction to Algebra

Introduction to Algebra INTRODUCTORY ALGEBRA Mini-Leture 1.1 Introdution to Alger Evlute lgeri expressions y sustitution. Trnslte phrses to lgeri expressions. 1. Evlute the expressions when =, =, nd = 6. ) d) 5 10. Trnslte eh

More information

Very sad code. Abstraction, List, & Cons. CS61A Lecture 7. Happier Code. Goals. Constructors. Constructors 6/29/2011. Selectors.

Very sad code. Abstraction, List, & Cons. CS61A Lecture 7. Happier Code. Goals. Constructors. Constructors 6/29/2011. Selectors. 6/9/ Abstrction, List, & Cons CS6A Lecture 7-6-9 Colleen Lewis Very sd code (define (totl hnd) (if (empty? hnd) (+ (butlst (lst hnd)) (totl (butlst hnd))))) STk> (totl (h c d)) 7 STk> (totl (h ks d)) ;;;EEEK!

More information

Lecture 13: Graphs I: Breadth First Search

Lecture 13: Graphs I: Breadth First Search Leture 13 Grphs I: BFS 6.006 Fll 2011 Leture 13: Grphs I: Bredth First Serh Leture Overview Applitions of Grph Serh Grph Representtions Bredth-First Serh Rell: Grph G = (V, E) V = set of verties (ritrry

More information

MATH 25 CLASS 5 NOTES, SEP

MATH 25 CLASS 5 NOTES, SEP MATH 25 CLASS 5 NOTES, SEP 30 2011 Contents 1. A brief diversion: reltively prime numbers 1 2. Lest common multiples 3 3. Finding ll solutions to x + by = c 4 Quick links to definitions/theorems Euclid

More information

Premaster Course Algorithms 1 Chapter 6: Shortest Paths. Christian Scheideler SS 2018

Premaster Course Algorithms 1 Chapter 6: Shortest Paths. Christian Scheideler SS 2018 Premster Course Algorithms Chpter 6: Shortest Pths Christin Scheieler SS 8 Bsic Grph Algorithms Overview: Shortest pths in DAGs Dijkstr s lgorithm Bellmn-For lgorithm Johnson s metho SS 8 Chpter 6 Shortest

More information

LING/C SC/PSYC 438/538. Lecture 21 Sandiway Fong

LING/C SC/PSYC 438/538. Lecture 21 Sandiway Fong LING/C SC/PSYC 438/538 Lecture 21 Sndiwy Fong Tody's Topics Homework 8 Review Optionl Homework 9 (mke up on Homework 7) Homework 8 Review Question1: write Prolog regulr grmmr for the following lnguge:

More information

CSCI 104. Rafael Ferreira da Silva. Slides adapted from: Mark Redekopp and David Kempe

CSCI 104. Rafael Ferreira da Silva. Slides adapted from: Mark Redekopp and David Kempe CSCI 0 fel Ferreir d Silv rfsilv@isi.edu Slides dpted from: Mrk edekopp nd Dvid Kempe LOG STUCTUED MEGE TEES Series Summtion eview Let n = + + + + k $ = #%& #. Wht is n? n = k+ - Wht is log () + log ()

More information

Distributed Systems Principles and Paradigms. Chapter 11: Distributed File Systems

Distributed Systems Principles and Paradigms. Chapter 11: Distributed File Systems Distriuted Systems Priniples nd Prdigms Mrten vn Steen VU Amsterdm, Dept. Computer Siene steen@s.vu.nl Chpter 11: Distriuted File Systems Version: Deemer 10, 2012 2 / 14 Distriuted File Systems Distriuted

More information

binary trees, expression trees

binary trees, expression trees COMP 250 Lecture 21 binry trees, expression trees Oct. 27, 2017 1 Binry tree: ech node hs t most two children. 2 Mximum number of nodes in binry tree? Height h (e.g. 3) 3 Mximum number of nodes in binry

More information

In the last lecture, we discussed how valid tokens may be specified by regular expressions.

In the last lecture, we discussed how valid tokens may be specified by regular expressions. LECTURE 5 Scnning SYNTAX ANALYSIS We know from our previous lectures tht the process of verifying the syntx of the progrm is performed in two stges: Scnning: Identifying nd verifying tokens in progrm.

More information

Pipeline Example: Cycle 1. Pipeline Example: Cycle 2. Pipeline Example: Cycle 4. Pipeline Example: Cycle 3. 3 instructions. 3 instructions.

Pipeline Example: Cycle 1. Pipeline Example: Cycle 2. Pipeline Example: Cycle 4. Pipeline Example: Cycle 3. 3 instructions. 3 instructions. ipeline Exmple: Cycle 1 ipeline Exmple: Cycle X X/ /W X X/ /W $3,$,$1 lw $,0($5) $3,$,$1 3 instructions 8 9 ipeline Exmple: Cycle 3 ipeline Exmple: Cycle X X/ /W X X/ /W sw $6,($7) lw $,0($5) $3,$,$1 sw

More information

Type Checking. Roadmap (Where are we?) Last lecture Context-sensitive analysis. This lecture Type checking. Symbol tables

Type Checking. Roadmap (Where are we?) Last lecture Context-sensitive analysis. This lecture Type checking. Symbol tables Type Cheking Rodmp (Where re we?) Lst leture Contet-sensitie nlysis Motition Attriute grmmrs Ad ho Synt-direted trnsltion This leture Type heking Type systems Using synt direted trnsltion Symol tles Leil

More information

What do all those bits mean now? Number Systems and Arithmetic. Introduction to Binary Numbers. Questions About Numbers

What do all those bits mean now? Number Systems and Arithmetic. Introduction to Binary Numbers. Questions About Numbers Wht do ll those bits men now? bits (...) Number Systems nd Arithmetic or Computers go to elementry school instruction R-formt I-formt... integer dt number text chrs... floting point signed unsigned single

More information

UNIT 11. Query Optimization

UNIT 11. Query Optimization UNIT Query Optimiztion Contents Introduction to Query Optimiztion 2 The Optimiztion Process: An Overview 3 Optimiztion in System R 4 Optimiztion in INGRES 5 Implementing the Join Opertors Wei-Png Yng,

More information

EECS 281: Homework #4 Due: Thursday, October 7, 2004

EECS 281: Homework #4 Due: Thursday, October 7, 2004 EECS 28: Homework #4 Due: Thursdy, October 7, 24 Nme: Emil:. Convert the 24-bit number x44243 to mime bse64: QUJD First, set is to brek 8-bit blocks into 6-bit blocks, nd then convert: x44243 b b 6 2 9

More information

Midterm Exam CSC October 2001

Midterm Exam CSC October 2001 Midterm Exm CSC 173 23 Otoer 2001 Diretions This exm hs 8 questions, severl of whih hve suprts. Eh question indites its point vlue. The totl is 100 points. Questions 5() nd 6() re optionl; they re not

More information

Can Pythagoras Swim?

Can Pythagoras Swim? Overview Ativity ID: 8939 Mth Conepts Mterils Students will investigte reltionships etween sides of right tringles to understnd the Pythgoren theorem nd then use it to solve prolems. Students will simplify

More information

Lesson 4.4. Euler Circuits and Paths. Explore This

Lesson 4.4. Euler Circuits and Paths. Explore This Lesson 4.4 Euler Ciruits nd Pths Now tht you re fmilir with some of the onepts of grphs nd the wy grphs onvey onnetions nd reltionships, it s time to egin exploring how they n e used to model mny different

More information

Representation of Numbers. Number Representation. Representation of Numbers. 32-bit Unsigned Integers 3/24/2014. Fixed point Integer Representation

Representation of Numbers. Number Representation. Representation of Numbers. 32-bit Unsigned Integers 3/24/2014. Fixed point Integer Representation Representtion of Numbers Number Representtion Computer represent ll numbers, other thn integers nd some frctions with imprecision. Numbers re stored in some pproximtion which cn be represented by fixed

More information

COMMON FRACTIONS. or a / b = a b. , a is called the numerator, and b is called the denominator.

COMMON FRACTIONS. or a / b = a b. , a is called the numerator, and b is called the denominator. COMMON FRACTIONS BASIC DEFINITIONS * A frtion is n inite ivision. or / * In the frtion is lle the numertor n is lle the enomintor. * The whole is seprte into "" equl prts n we re onsiering "" of those

More information

Advanced Programming Handout 5. Enter Okasaki. Persistent vs. Ephemeral. Functional Queues. Simple Example. Persistent vs.

Advanced Programming Handout 5. Enter Okasaki. Persistent vs. Ephemeral. Functional Queues. Simple Example. Persistent vs. Avne Progrmming Hnout 5 Purel Funtionl Dt Strutures: A Cse Stu in Funtionl Progrmming Persistent vs. Ephemerl An ephemerl t struture is one for whih onl one version is ville t time: fter n upte opertion,

More information

Pattern Matching. Pattern Matching. Pattern Matching. Review of Regular Expressions

Pattern Matching. Pattern Matching. Pattern Matching. Review of Regular Expressions Pttern Mthing Pttern Mthing Some of these leture slides hve een dpted from: lgorithms in C, Roert Sedgewik. Gol. Generlize string serhing to inompletely speified ptterns. pplitions. Test if string or its

More information

Hash-based Subgraph Query Processing Method for Graph-structured XML Documents

Hash-based Subgraph Query Processing Method for Graph-structured XML Documents Hsh-bse Subgrph Query Proessing Metho for Grph-struture XML Douments Hongzhi Wng Hrbin Institute of Teh. wngzh@hit.eu.n Jinzhong Li Hrbin Institute of Teh. lijzh@hit.eu.n Jizhou Luo Hrbin Institute of

More information

Section 10.4 Hyperbolas

Section 10.4 Hyperbolas 66 Section 10.4 Hyperbols Objective : Definition of hyperbol & hyperbols centered t (0, 0). The third type of conic we will study is the hyperbol. It is defined in the sme mnner tht we defined the prbol

More information

10.5 Graphing Quadratic Functions

10.5 Graphing Quadratic Functions 0.5 Grphing Qudrtic Functions Now tht we cn solve qudrtic equtions, we wnt to lern how to grph the function ssocited with the qudrtic eqution. We cll this the qudrtic function. Grphs of Qudrtic Functions

More information

9.1 apply the distance and midpoint formulas

9.1 apply the distance and midpoint formulas 9.1 pply the distnce nd midpoint formuls DISTANCE FORMULA MIDPOINT FORMULA To find the midpoint between two points x, y nd x y 1 1,, we Exmple 1: Find the distnce between the two points. Then, find the

More information

Asurveyofpractical algorithms for suffix tree construction in external memory

Asurveyofpractical algorithms for suffix tree construction in external memory Asurveyofprtil lgorithms for suffix tree onstrution in externl memory M. Brsky,, U. Stege n A. Thomo University of Vitori, PO Box, STN CSC Vitori, BC, VW P, Cn SUMMAY The onstrution of suffix trees in

More information

6.045J/18.400J: Automata, Computability and Complexity. Quiz 2: Solutions. Please write your name in the upper corner of each page.

6.045J/18.400J: Automata, Computability and Complexity. Quiz 2: Solutions. Please write your name in the upper corner of each page. 6045J/18400J: Automt, Computbility nd Complexity Mrh 30, 2005 Quiz 2: Solutions Prof Nny Lynh Vinod Vikuntnthn Plese write your nme in the upper orner of eh pge Problem Sore 1 2 3 4 5 6 Totl Q2-1 Problem

More information

Homework. Context Free Languages III. Languages. Plan for today. Context Free Languages. CFLs and Regular Languages. Homework #5 (due 10/22)

Homework. Context Free Languages III. Languages. Plan for today. Context Free Languages. CFLs and Regular Languages. Homework #5 (due 10/22) Homework Context Free Lnguges III Prse Trees nd Homework #5 (due 10/22) From textbook 6.4,b 6.5b 6.9b,c 6.13 6.22 Pln for tody Context Free Lnguges Next clss of lnguges in our quest! Lnguges Recll. Wht

More information

Shared Memory Architectures. Programming and Synchronization. Today s Outline. Page 1. Message passing review Cosmic Cube discussion

Shared Memory Architectures. Programming and Synchronization. Today s Outline. Page 1. Message passing review Cosmic Cube discussion Tody s Outline Arhitetures Progrmming nd Synhroniztion Disuss pper on Cosmi Cube (messge pssing) Messge pssing review Cosmi Cube disussion > Messge pssing mhine Shred memory model > Communition > Synhroniztion

More information

Union-Find Problem. Using Arrays And Chains. A Set As A Tree. Result Of A Find Operation

Union-Find Problem. Using Arrays And Chains. A Set As A Tree. Result Of A Find Operation Union-Find Problem Given set {,,, n} of n elements. Initilly ech element is in different set. ƒ {}, {},, {n} An intermixed sequence of union nd find opertions is performed. A union opertion combines two

More information

Kulleġġ San Ġorġ Preca Il-Liċeo tas-subien Ħamrun. Name & Surname: A) Mark the correct answer by inserting an X in the correct box. a b c d.

Kulleġġ San Ġorġ Preca Il-Liċeo tas-subien Ħamrun. Name & Surname: A) Mark the correct answer by inserting an X in the correct box. a b c d. Kulleġġ Sn Ġorġ Pre Il-Liċeo ts-suien Ħmrun Hlf Yerly Exmintion 2012 Trk 3 Form 3 INFORMATION TECHNOLOGY Time : 1hr 30 mins Nme & Surnme: Clss: A) Mrk the orret nswer y inserting n X in the orret ox. 1)

More information

Distributed Systems Principles and Paradigms

Distributed Systems Principles and Paradigms Distriuted Systems Priniples nd Prdigms Christoph Dorn Distriuted Systems Group, Vienn University of Tehnology.dorn@infosys.tuwien..t http://www.infosys.tuwien..t/stff/dorn Slides dpted from Mrten vn Steen,

More information

Graph Contraction and Connectivity

Graph Contraction and Connectivity Chpter 14 Grph Contrtion n Connetivity So fr we hve mostly overe tehniques for solving problems on grphs tht were evelope in the ontext of sequentil lgorithms. Some of them re esy to prllelize while others

More information

Lexical analysis, scanners. Construction of a scanner

Lexical analysis, scanners. Construction of a scanner Lexicl nlysis scnners (NB. Pges 4-5 re for those who need to refresh their knowledge of DFAs nd NFAs. These re not presented during the lectures) Construction of scnner Tools: stte utomt nd trnsition digrms.

More information

Correcting the Dynamic Call Graph Using Control Flow Constraints

Correcting the Dynamic Call Graph Using Control Flow Constraints Correting the Dynmi Cll Grph Using Control Flow Constrints Byeongheol Lee Kevin Resnik Mihel Bond Kthryn MKinley 1 Appered in CC2007 Motivtion Complexity of lrge objet oriented progrms Deompose the progrm

More information

How to Design REST API? Written Date : March 23, 2015

How to Design REST API? Written Date : March 23, 2015 Visul Prdigm How Design REST API? Turil How Design REST API? Written Dte : Mrch 23, 2015 REpresenttionl Stte Trnsfer, n rchitecturl style tht cn be used in building networked pplictions, is becoming incresingly

More information

Mid-term exam. Scores. Fall term 2012 KAIST EE209 Programming Structures for EE. Thursday Oct 25, Student's name: Student ID:

Mid-term exam. Scores. Fall term 2012 KAIST EE209 Programming Structures for EE. Thursday Oct 25, Student's name: Student ID: Fll term 2012 KAIST EE209 Progrmming Structures for EE Mid-term exm Thursdy Oct 25, 2012 Student's nme: Student ID: The exm is closed book nd notes. Red the questions crefully nd focus your nswers on wht

More information

12-B FRACTIONS AND DECIMALS

12-B FRACTIONS AND DECIMALS -B Frctions nd Decimls. () If ll four integers were negtive, their product would be positive, nd so could not equl one of them. If ll four integers were positive, their product would be much greter thn

More information

What do all those bits mean now? Number Systems and Arithmetic. Introduction to Binary Numbers. Questions About Numbers

What do all those bits mean now? Number Systems and Arithmetic. Introduction to Binary Numbers. Questions About Numbers Wht do ll those bits men now? bits (...) Number Systems nd Arithmetic or Computers go to elementry school instruction R-formt I-formt... integer dt number text chrs... floting point signed unsigned single

More information

acronyms possibly used in this test: CFG :acontext free grammar CFSM :acharacteristic finite state machine DFA :adeterministic finite automata

acronyms possibly used in this test: CFG :acontext free grammar CFSM :acharacteristic finite state machine DFA :adeterministic finite automata EE573 Fll 2002, Exm open book, if question seems mbiguous, sk me to clrify the question. If my nswer doesn t stisfy you, plese stte your ssumptions. cronyms possibly used in this test: CFG :context free

More information

Honors Thesis: Investigating the Algebraic Properties of Cayley Digraphs

Honors Thesis: Investigating the Algebraic Properties of Cayley Digraphs Honors Thesis: Investigting the Algebri Properties of Cyley Digrphs Alexis Byers, Wittenberg University Mthemtis Deprtment April 30, 2014 This pper utilizes Grph Theory to gin insight into the lgebri struture

More information

CSE 401 Midterm Exam 11/5/10 Sample Solution

CSE 401 Midterm Exam 11/5/10 Sample Solution Question 1. egulr expressions (20 points) In the Ad Progrmming lnguge n integer constnt contins one or more digits, but it my lso contin embedded underscores. Any underscores must be preceded nd followed

More information

Stack Manipulation. Other Issues. How about larger constants? Frame Pointer. PowerPC. Alternative Architectures

Stack Manipulation. Other Issues. How about larger constants? Frame Pointer. PowerPC. Alternative Architectures Other Issues Stck Mnipultion support for procedures (Refer to section 3.6), stcks, frmes, recursion mnipulting strings nd pointers linkers, loders, memory lyout Interrupts, exceptions, system clls nd conventions

More information

Phylogeny and Molecular Evolution

Phylogeny and Molecular Evolution Phylogeny nd Moleculr Evolution Chrcter Bsed Phylogeny 1/50 Credit Ron Shmir s lecture notes Notes by Nir Friedmn Dn Geiger, Shlomo Morn, Sgi Snir nd Ron Shmir Durbin et l. Jones nd Pevzner s presenttion

More information

COMP108 Algorithmic Foundations

COMP108 Algorithmic Foundations Grph Theory Prudene Wong http://www.s.liv..uk/~pwong/tehing/omp108/201617 How to Mesure 4L? 3L 5L 3L ontiner & 5L ontiner (without mrk) infinite supply of wter You n pour wter from one ontiner to nother

More information

Structure of a Typical Interpreter. Compiler. Scanning and Parsing. Lexical Analysis (Scanning) Interaction Between Scanning and Parsing

Structure of a Typical Interpreter. Compiler. Scanning and Parsing. Lexical Analysis (Scanning) Interaction Between Scanning and Parsing Snning nd Prsing Announements Projet 1 is 5% of totl grde Projet 2 is 10% of totl grde Projet 3 is 15% of totl grde Projet 4 is 10% of totl grde Tody Outline of plnned topis for ourse Overll struture of

More information

12/9/14. CS151 Fall 20124Lecture (almost there) 12/6. Graphs. Seven Bridges of Königsberg. Leonard Euler

12/9/14. CS151 Fall 20124Lecture (almost there) 12/6. Graphs. Seven Bridges of Königsberg. Leonard Euler CS5 Fll 04Leture (lmost there) /6 Seven Bridges of Königserg Grphs Prof. Tny Berger-Wolf Leonrd Euler 707-783 Is it possile to wlk with route tht rosses eh ridge e Seven Bridges of Königserg Forget unimportnt

More information

Duality in linear interval equations

Duality in linear interval equations Aville online t http://ijim.sriu..ir Int. J. Industril Mthemtis Vol. 1, No. 1 (2009) 41-45 Dulity in liner intervl equtions M. Movhedin, S. Slhshour, S. Hji Ghsemi, S. Khezerloo, M. Khezerloo, S. M. Khorsny

More information

CSc 453 Compilers and Systems Software. 6 : Top-Down Parsing I

CSc 453 Compilers and Systems Software. 6 : Top-Down Parsing I C 45 Compilers n ystems oftwre 6 : op-down Prsing I Christin Collberg Deprtment of Computer iene University of rizon ollberg@gmil.om Copyright 2009 Christin Collberg eptember 14, 2009 1 Overview 2 Compiler

More information

Dynamic Programming. Andreas Klappenecker. [partially based on slides by Prof. Welch] Monday, September 24, 2012

Dynamic Programming. Andreas Klappenecker. [partially based on slides by Prof. Welch] Monday, September 24, 2012 Dynmic Progrmming Andres Klppenecker [prtilly bsed on slides by Prof. Welch] 1 Dynmic Progrmming Optiml substructure An optiml solution to the problem contins within it optiml solutions to subproblems.

More information

To access your mailbox from inside your organization. For assistance, call:

To access your mailbox from inside your organization. For assistance, call: 2001 Ative Voie, In. All rights reserved. First edition 2001. Proteted y one or more of the following United Sttes ptents:,070,2;,3,90;,88,0;,33,102;,8,0;,81,0;,2,7;,1,0;,90,88;,01,11. Additionl U.S. nd

More information

Definition of Regular Expression

Definition of Regular Expression Definition of Regulr Expression After the definition of the string nd lnguges, we re redy to descrie regulr expressions, the nottion we shll use to define the clss of lnguges known s regulr sets. Recll

More information

Chapter Spline Method of Interpolation More Examples Electrical Engineering

Chapter Spline Method of Interpolation More Examples Electrical Engineering Chpter. Spline Method of Interpoltion More Exmples Electricl Engineering Exmple Thermistors re used to mesure the temperture of bodies. Thermistors re bsed on mterils chnge in resistnce with temperture.

More information

CS321 Languages and Compiler Design I. Winter 2012 Lecture 5

CS321 Languages and Compiler Design I. Winter 2012 Lecture 5 CS321 Lnguges nd Compiler Design I Winter 2012 Lecture 5 1 FINITE AUTOMATA A non-deterministic finite utomton (NFA) consists of: An input lphet Σ, e.g. Σ =,. A set of sttes S, e.g. S = {1, 3, 5, 7, 11,

More information

Unit 5 Vocabulary. A function is a special relationship where each input has a single output.

Unit 5 Vocabulary. A function is a special relationship where each input has a single output. MODULE 3 Terms Definition Picture/Exmple/Nottion 1 Function Nottion Function nottion is n efficient nd effective wy to write functions of ll types. This nottion llows you to identify the input vlue with

More information

Lecture 12 : Topological Spaces

Lecture 12 : Topological Spaces Leture 12 : Topologil Spes 1 Topologil Spes Topology generlizes notion of distne nd loseness et. Definition 1.1. A topology on set X is olletion T of susets of X hving the following properties. 1. nd X

More information

This Unit: Processor Design. What Is Control? Example: Control for sw. Example: Control for add

This Unit: Processor Design. What Is Control? Example: Control for sw. Example: Control for add This Unit: rocessor Design Appliction O ompiler U ory Firmwre I/O Digitl ircuits Gtes & Trnsistors pth components n timing s n register files ories (RAMs) locking strtegies Mpping n IA to tpth ontrol Exceptions

More information

Table-driven look-ahead lexical analysis

Table-driven look-ahead lexical analysis Tle-riven look-he lexil nlysis WUU YANG Computer n Informtion Siene Deprtment Ntionl Chio-Tung University, HsinChu, Tiwn, R.O.C. Astrt. Moern progrmming lnguges use regulr expressions to efine vli tokens.

More information

Calculus Differentiation

Calculus Differentiation //007 Clulus Differentition Jeffrey Seguritn person in rowot miles from the nerest point on strit shoreline wishes to reh house 6 miles frther down the shore. The person n row t rte of mi/hr nd wlk t rte

More information

Digital Design. Chapter 1: Introduction. Digital Design. Copyright 2006 Frank Vahid

Digital Design. Chapter 1: Introduction. Digital Design. Copyright 2006 Frank Vahid Chpter : Introduction Copyright 6 Why Study?. Look under the hood of computers Solid understnding --> confidence, insight, even better progrmmer when wre of hrdwre resource issues Electronic devices becoming

More information

Bayesian Networks: Directed Markov Properties (Cont d) and Markov Equivalent DAGs

Bayesian Networks: Directed Markov Properties (Cont d) and Markov Equivalent DAGs Byesin Networks: Direte Mrkov Properties (Cont ) n Mrkov Equivlent DAGs Huizhen Yu jney.yu@s.helsinki.fi Dept. Computer Siene, Univ. of Helsinki Proilisti Moels, Spring, 2010 Huizhen Yu (U.H.) Byesin Networks:

More information

Small Business Networking

Small Business Networking Why network is n essentil productivity tool for ny smll business Effective technology is essentil for smll businesses looking to increse the productivity of their people nd business. Introducing technology

More information

Reducing Costs with Duck Typing. Structural

Reducing Costs with Duck Typing. Structural Reducing Costs with Duck Typing Structurl 1 Duck Typing In computer progrmming with object-oriented progrmming lnguges, duck typing is lyer of progrmming lnguge nd design rules on top of typing. Typing

More information

Internet Routing. Reminder: Routing. CPSC Network Programming

Internet Routing. Reminder: Routing. CPSC Network Programming PS 360 - Network Progrmming Internet Routing Mihele Weigle eprtment of omputer Siene lemson University mweigle@s.lemson.eu pril, 00 http://www.s.lemson.eu/~mweigle/ourses/ps360 Reminer: Routing Internet

More information

Improper Integrals. October 4, 2017

Improper Integrals. October 4, 2017 Improper Integrls October 4, 7 Introduction We hve seen how to clculte definite integrl when the it is rel number. However, there re times when we re interested to compute the integrl sy for emple 3. Here

More information

INTRODUCTION TO SIMPLICIAL COMPLEXES

INTRODUCTION TO SIMPLICIAL COMPLEXES INTRODUCTION TO SIMPLICIAL COMPLEXES CASEY KELLEHER AND ALESSANDRA PANTANO 0.1. Introduction. In this ctivity set we re going to introduce notion from Algebric Topology clled simplicil homology. The min

More information

PROBLEM OF APOLLONIUS

PROBLEM OF APOLLONIUS PROBLEM OF APOLLONIUS In the Jnury 010 issue of Amerin Sientist D. Mkenzie isusses the Apollonin Gsket whih involves fining the rius of the lrgest irle whih just fits into the spe etween three tngent irles

More information

1 Quad-Edge Construction Operators

1 Quad-Edge Construction Operators CS48: Computer Grphics Hndout # Geometric Modeling Originl Hndout #5 Stnford University Tuesdy, 8 December 99 Originl Lecture #5: 9 November 99 Topics: Mnipultions with Qud-Edge Dt Structures Scribe: Mike

More information

Compilers Spring 2013 PRACTICE Midterm Exam

Compilers Spring 2013 PRACTICE Midterm Exam Compilers Spring 2013 PRACTICE Midterm Exm This is full length prctice midterm exm. If you wnt to tke it t exm pce, give yourself 7 minutes to tke the entire test. Just like the rel exm, ech question hs

More information

Final Exam Review F 06 M 236 Be sure to look over all of your tests, as well as over the activities you did in the activity book

Final Exam Review F 06 M 236 Be sure to look over all of your tests, as well as over the activities you did in the activity book inl xm Review 06 M 236 e sure to loo over ll of your tests, s well s over the tivities you did in the tivity oo 1 1. ind the mesures of the numered ngles nd justify your wor. Line j is prllel to line.

More information

Small Business Networking

Small Business Networking Why network is n essentil productivity tool for ny smll business Effective technology is essentil for smll businesses looking to increse the productivity of their people nd business. Introducing technology

More information

Lists in Lisp and Scheme

Lists in Lisp and Scheme Lists in Lisp nd Scheme Lists in Lisp nd Scheme Lists re Lisp s fundmentl dt structures, ut there re others Arrys, chrcters, strings, etc. Common Lisp hs moved on from eing merely LISt Processor However,

More information

Sample Midterm Solutions COMS W4115 Programming Languages and Translators Monday, October 12, 2009

Sample Midterm Solutions COMS W4115 Programming Languages and Translators Monday, October 12, 2009 Deprtment of Computer cience Columbi University mple Midterm olutions COM W4115 Progrmming Lnguges nd Trnsltors Mondy, October 12, 2009 Closed book, no ids. ch question is worth 20 points. Question 5(c)

More information