Presentation is loading. Please wait.

Presentation is loading. Please wait.

Assignment #1 Due: Feb. 15, 2017 3. Apply the following algorithm to the B+-tree shown in Fig. 4 to store it in a data file. Trace the computation process.

Similar presentations


Presentation on theme: "Assignment #1 Due: Feb. 15, 2017 3. Apply the following algorithm to the B+-tree shown in Fig. 4 to store it in a data file. Trace the computation process."— Presentation transcript:

1 Assignment #1 Due: Feb. 15, 2017 3. Apply the following algorithm to the B+-tree shown in Fig. 4 to store it in a data file. Trace the computation process. Algorithm: push(root, -1, -1); while (S is not empty) do { x := pop( ); store x.data in file F; assume that the address of x in F is ad; if x.address-of-parent  -1 then { y := x.address-of-parent; z := x.position; write ad in page y at position z in F; } let x1, …, xk be the children of v; for (i = k to 1) {push(xi, ad, i)}; 6 4 1 3 5 Fig. 4 5/3/2019 ACS-7102 Yangjun Chen

2 S: data address-of- parent position key values in a node
3, 5 -1 3 5 B+-tree file S: data address-of- parent position 6 3 4 2 1, 3 1 key values in a node indicate what child (of its Parent) a node is. 1 3 5 B+-tree file 6 3 4 2 S: 1 5/3/2019 ACS-7102 Yangjun Chen

3 S: data address-of- parent position key values empty B+-tree file 6 3
1 3 2 5 B+-tree file 6 3 S: 1 4 2 data address-of- parent position key values B+-tree file S: 1 3 2 5 3 1 1 3 2 empty 4 3 6 5/3/2019 ACS-7102 Yangjun Chen

4 5. Represent the following graph as an XML document.
sw book title year Carrie Fisher street city Maple H’wood Locust Malibu Mark Hamill Oak B’wood 1977 cf mh root author name address writing authorOf Star War ad1 ad2 The MIT Press publisher 5/3/2019 ACS-7102 Yangjun Chen

5 <? Xml version = “1.0” encoding = “utf-8” standalone = “yes” ?>
<StarMovieData> <Star starID = “cf” starredIn = “sw”> <Name>Carrie Fishes</Name> <Address> <Street>123 Maple St.</Street><City>Hollywood</City> </Address> <Street>5 Locust Ln.</Street><City>Malibu</City> </Star> <Star starID = “mh” starredIn = “sw”> <Name>Mark Hamill</Name><Street>456 Oak Rd.</Street> <City>Brentwood</City> <Movie movieID = “sw” starOf = “cf mh”> <Title>Star Wars</title><Year>1977</Year> </Movie> </StarMovieData> 5/3/2019 ACS-7102 Yangjun Chen


Download ppt "Assignment #1 Due: Feb. 15, 2017 3. Apply the following algorithm to the B+-tree shown in Fig. 4 to store it in a data file. Trace the computation process."

Similar presentations


Ads by Google