Enter title here - PowerPoint PPT Presentation

1 / 81
About This Presentation
Title:

Enter title here

Description:

12.0 b- b+ 12.1 12.2 12.3 12.4 – PowerPoint PPT presentation

Number of Views:40
Avg rating:3.0/5.0
Slides: 82
Provided by: lyl3
Category:
Tags: enter | here | title | vsam

less

Transcript and Presenter's Notes

Title: Enter title here


1
???? ? ?
12.0 B-??B? 12.1 ????????? 12.2 ? ? ?
? 12.3 ? ? ? ? 12.4 ? ? ? ? ? ? 12.5 ? ? ?
? ? ?

2
12.0 B-??B?
??B-? B-???????????,????????????,???? m?B-? ????,
?????????m?? (1)?????????m??? (2)?????????,?????
2??? (3)????????,????????m/2???? (4)????????????
(n, A0, K1,A1, K2, A2, , Kn, An)
3
??Ki????,? Ki lt Ki1, Ai????i??????,?????????????K
i, ??Ki1 N??????,n1????? (5)????????,?????(????)
1
35
2
78
18
43
1
1
27
1
40
3
49
54
62
1
85
1
11
F
F
F
F
F
F
F
F
F
F
F
F
4?B-?
4
B-????
  • B-????????????,????????????????????/????,????????
    ??
  • m?B-???????????m?
  • m?B-???K????????????K-1????

3?B-?,??2-3?,??????2???,??3????
5
Typedef struct BTNode int keynum struct
BTNode parent struct BTNode ptrm1
KeyType keym1 // key0?? Record
recptrm1 BTNoode,Btree Typedef struct
BTNode pt//??????? int i//?????????? int
tag//?????? Result
6
B-??????
1??? 2??? 3???
7
Result search(Btree T,KeyType key) pT
qNULL foundfalse i0 while (p
!found) np.keynum for (i1
iltn i) if (keyikey)
foundtrue break else if
(keyigtkey) break if (!found) qp
pp-gtptri-1 if (found) return
(p,i,true) //???? else return(q,i,false)
// ????,?????? // search
8
B-????? ?? ????(??) ?? 1 0 1
2 2 m 3 2m/2 m2
4 2m/22 m3 h 2m/2h-2
mh-1 ??h1??????, N????,?N1????(???????)
?? N1gt 2m/2h-1 ?????????
9
B-???????????????????,???????,?B-??????,(????????)
,?????????.??B-??????,
B-????
??????
10
  • ??B_???? m 200,????? N 1999999,?B_???? h ???

log100 1000000 1 4
???????,?????
11
  • B-???
  • B-??????????,???????????
  • ?

bt
bt
??30
45
45
24
53 90
24
53 90
3 12
37
50
61 70
100
3 12
30 37
50
61 70
100
12
bt
??26
45
24
53 90
3 12
30 37
50
61 70
100
13
bt
??85
45
24 30
53 90
3 12
26
50
61 70
100
37
14
  • ????????,??????????,??????????????????????????????
    ??

15
  • ????
  • 1.??,???????
  • 2.?????? (p,i) , p?????
  • 3. ?key ???(p,i)?
  • 4. ?p?key??m-1,???????,????
  • ?p???

p
K1 K2 . Ki-1 Ki Ki1 . Km

P???
K1 Ki K
K1 K2 . Ki-1
Ki1 . Km
Ki
P????
16
  • ?p??

p
K1 K2 . Ki-1 Ki Ki1 . Km

Ki
?????
K1 K2 . Ki-1
Ki1 . Km
Ki
P????
5. P??????, ?4
17
?? Void insertBTree(Btree T,KeyType K, BTree q,
int i) //?m?B-????q?i????K xK
apNULL finishedfalse while (q
!finished) // ?x???q.keyi1,
ap???q.ptri1 insert(q,i,x,ap)
if (q.keynumltm) finishedtrue //????
else sm/2 split(q,ap)
xq.keys // ??q qq-gtparent
if (q) isearch(q,x) // ??????????????
// if (!finished)
newRoot(T,q,x,ap) //????? // while
// insertBTree
18
B-??? 1. ??????key ?????(p, i)//?p.keyi 2.
p??????? ?4?B-?
?p???ptri?????key1,??key,??????key1,????????
???????key,????,??????????,p?????
p
15 20
8 12
17
25 30
16
18
????
????
19
3. p????,?3??? (1) p???????m/2??keyi?ptr
i,?? (2) p?????m/2-1,????(????)??????m/2
??????????
8 12
??10
8 12
8 14
6
10
14 18
6
12
18
???????????????????
20
3 p????,?3??? (3) p?????m/2-1,??????????
m/2-1?p??(??)????,???????
??10
8 12
8
6
10
14
6
12 14
??????????? ???????????key,?????????????key,?????
????
21
??B? B??B-??????,????????????,???? m?B? ????,
?????????m?? (1)?????????m??? (2)?????,???2???
(3)????????????m/2???? (4)????????????
(n, K1,A1, K2, A2, , Kn, An)
22
??Ki????,? Ki lt Ki1, Ai????i?????,Ki?Ai??????
?n?????????n???? (5)???????????
root
?????
59
97
3?B?
15
59
72
44
97
sqt
10
21
44
51
63
81
97
15
37
59
72
91
6 8 10
11 13 15
18 20 21
25 30 37
39 42 40
47 49 51
53 56 59
60 62 63
64 68 72
75 78 81
83 88 91
93 96 97
???
23
B????
  • 1.B????
  • ?B-????????
  • ?????????????????,????,????????
  • B??,?? ??????,?????????????

24
2?B?????(???????)
  • 1.?????? (p,i)
  • 2.??key
  • 3.p?????
  • (1)?p??????m,??
  • (2)??,?p?????2???,????????????k, ?
  • P????k???p????,p?????
  • P????????root,?key???root?,??
  • 4.??2

25
3?B?
59
97
??39
15
59
72
97
44
10
21
44
51
63
81
97
39
15
37
59
72
91
???
59
97
44
59
15
72
37
97
10
21
51
63
81
97
15
37
59
72
91
44
39
26
59
37
97
44
59
15
72
37
97
10
21
51
63
81
97
44
39
15
37
59
72
91
27
?????? 1.?????? (p,i)???? 2.??p.keyi 3.p?4
??? (1)p??,????,??p ,??????,??
(2)?p????????m/2?,??
28
(3)?p??????m/2? -1 ,????(????)???????m/2?
??????????????p?,??????p?????????
81
97
72
97
63
97
81
91
63
81
97
72
91
?????,????????????????????p?,???????????????????
?
72
91
81
97
63
91
72
81
81
63
97
72
91
29
  • (4)?p??????m/2? -1 ,????????????m/2?
  • ???????p?????,??p?????????

15
59
15
59
44
10
21
44
51
10
51
21
15
59
15
59
  • ???????p?????,??????????????,???p????

15
59
15
51
44
10
21
44
51
10
44
21
15
59
15
51
30
12.1 ?????????
1.?? ?????????????
?????????,????????????????????????????????????
???
31
12.1 ?????????
2.??????????????????
  • ??????????????????????????????????????????,??????
    ??????,?????????????,?????????????
  • ???????????????,?????????????????????????,???????
    ???????????

??????????????????
32
12.1 ?????????
3.??? ????????????????????? ??????????????,?
??????,????????????????
4.?????????? ???????????????????????????
??????????????????????????
33
12.1 ?????????
7
5
??1
2
??2
1
??3
4
??4
3
??n
6
?????? gtgt--ltlt ????
34
12.1 ?????????
5.?????
  • ????????????????
  • ???????i???
  • ????????????????????

? ?
  • ?????????????
  • ?????????????
  • ????????????

? ?
? ?
  • ????
  • ???

???????
35
12.1 ?????????
6.???????
????
????
???
36
12.2 ????(Sequence file)
  • ????

???????????????????????????,
?????????????????????????????????.
  • ??????????????

??????????????????????
???????????????????
37
????
  • 1.????????
  • 2.?????????,???i???,??????i-1???,?????????????????
    ??????
  • 3.???????????????
  • 4.?????,????
  • 5.?????,???????????,?????????

???????????????
38
  • ????

????????????????????????????????,?????,???????????
??,?????,????????????????(???????????),?????
,????????????????????????????????.(p.309)
(1)?????????????????????
(2)???????????????????????????
39
????
?????
????
????
No 0001 Balance 100 No 0006 Balance 50 No
0008 Balance 150 No 0011 Balance 10 No
0012 Balance 140 No 0013 Balance 190
No0002 New100 No0006 Deposit 100 No
0008 Withdraw100 No0011 Cancel10
No 0001 Balance 100 No0002 N100 No
0006 Balance 150 No 0008 Balance 50 No
0012 Balance 140 No 0013 Balance 190
??????????
40
????????
????????????????
????????n???,???????m???,?????????????????O(mlo
gm)???????????O(mn), ???????????O(nmlogm)

??????????/??s???,??????????/???????2??m/s??(
mn)/s?)
(??s?????????/?????)
41
12.3 ? ? ? ?
1??????
??????? n ???,?????????????????,??????,???????
???????????????????,??????????,???????????????????
????????
42
  • ??????????????,????????? 1k ?????.

???????????64k?????,???????????? 64
??????????????? 14400 ?,??????????????????????????
?????,????????????
43
(No Transcript)
44
  • ????????????4???, ????? ????????,? 14400 ??????
    56.25k ??, ???????????????????????????????,??????
    ?????????????,??? 1 ???????????????

45
12.3 ? ? ? ?
2?????
  • 1.????????????????
  • 2.??????????????????
  • 3.??,??????????????,??? (??????)??????
  • 4.???????????????????????????????,????????????

46
??r1,r2,,rn
??? (?????,??)
r1 A1 r2 A2 r3 A3 .. rn An
????
???
47
3??????
  • 1.?????????????????????????????????,??????????
    ??????
  • 2.?????,???????????,???????????????????????,??
    ?????????????
  • 3.?????,?????????????????
  • 4.?????,?????????????????,???????????

48
4? ?????????
1.? ? ? ? ? ?
  • ?????????????,??????????,???????,???????????

2.? ? ? ?
  • ?????????,?????(?)??????????,???????????

49
1.??????
??????
  • ?????????????????????????????????????????????????
    ????????????,?????????????????

????????????????
???? ????????????
50
???????????,????????
51
  • ??????????????????,????? n ????? b
    ???(?)??,???????????????(??)?

????? ???????????
????????????
52
(No Transcript)
53
?????
...
?????????,????????,?????????
? ? ? ??
...
? ? ?
...
? ? ?
...
? ? ?
?????????????
54
????????????????
2.????
  • 1)?????????
  • 2)??????????????
  • 3)????????,??????

?????????,?????????????????????????
???????????????B????
55
3?B?
56
12.4 ??????
????
??????????,????????????(???????)?
????????????
??ISAM?? ISAM(Index Sequential Access
Method) (????????)??????????????????????????
57
1.???????
??????????,??????????????????????
??????
??? ?? ??? ??
?????
?????
58
????
??C1
R14
R21
R45
R47
R50
50
164
R164
330
???
164
????
??C2
215
620
R189
R215
1100
620
R330
810
330
???
????
??Cn
3843
R3843
4150
???(?????)
4150
4150
R4150
???
????
????
59
?????
??????1??????????????(?????) 2????????????
3???????????
?? C1
???????
????
1 ?
??? ?? ??? ??
2 ? ? 18 ? ? ? ?
????? ?????
????? ????????? ??? ?
??????? ???? ????? ?????????
?????? ?? ? ???????
?????? ??????
19?20??????
60
2.?????
  • ???? ????????????
  • ?????? ??????,?????,?????,
  • ??????,?????????

??
??
  • ????????????????
  • ????????????????????????
  • ?????????(?????????????)?

??
  • ??????????????????

61
  • ?? R14?R21?R43?R47?R50?? 2 ??R60?R70?R80?R85?R
    90??3??

?? C1
2?3 ????????
????
1 ?
50 T2 1
R14 R21 R43 R47 R50
2 ? 3 ?
90 T3 1
R60 R70 R80 R85 R90
19?20??????
62
  • ?? R30 ?? 2 ?????

?? C1
2?3 ????????
????
1 ?
47 T2 1 50 T19 1
R14 R21 R30 R43 R47
2 ? 3 ?
90 T3 1
R60 R70 R80 R85 R90
R50 ?
19?20??????
63
  • ?? R65 ?? 3 ?????

?? C1
2?3 ????????
????
1 ?
47 T2 1 50 T19 1
R14 R21 R30 R43 R47
2 ? 3 ?
85 T3 1 90 T19 2
R60 R65 R70 R80 R85
R50 ? R90 ?
19?20??????
64
  • ?? R48 ?? 2 ?????? 48 gt 47 , ??????????

?? C1
2?3 ????????
????
1 ?
47 T2 1 50 T19 3
R14 R21 R30 R43 R47
2 ? 3 ?
85 T3 1 90 T19 2
R60 R65 R70 R80 R85
R50 ? R90 ? R48
19?20??????
65
  • ?? ??????????????????????????????? ISAM ?
    ????? R21?

?? C1
2?3 ????????
????
1 ?
47 T2 1 50 T19 3
R14 R21 R30 R43 R47
2 ? 3 ?
85 T3 1 90 T19 2
R60 R65 R70 R80 R85
R50 ? R90 ? R48
19?20??????
66
3.????
???????????????,?????????????,?????????
???????????,??????????????,?ISAM??,??????????
4.???????
ISAM????????,?????????????,?????????????,
????????????????????????
67
??VSAM?? VSAM(Vistual Storage Access Method)
1.?????VSAM ? ??????????????????????????,???????/?
?????????????,?????,?????????????????????????????,
?????,????????
68
2.?????
B?
??? ???
...
...
...
...
???
????
????
69
  • ????(??)??????????????,??????????????????????????
  • ????(???)????????????????,??????????.
  • ???????????,???????????,??,???????????B??????,???
    ??????B???????

70
root
?????
59
97
3?B?
15
59
72
44
97
sqt
10
21
44
51
63
81
97
15
37
59
72
91
6 8 10
11 13 15
18 20 21
25 30 37
39 42 40
47 49 51
53 56 59
60 62 63
64 68 72
75 78 81
83 88 91
93 96 97
????
????
71
3.VSAM ??????
??1 ??2 ??n ??n????
??1???? ?????????
??????????????????????????????????
VSAM?????,????????????????,????????????????
72
4.?????
  • ????????????????
  • ?????????????????????,????????????????????,????
    ???,???,?????????
  • ???????????,?????????????

73
5.VSAM???????????????????????
??????????????, ???????????????????????
?????????????,???????75?????????(??,?????,??????
???????)
74
12.5 ? ? ? ? ? ?
1.???????????????,??????????,???????????????????
????
???????????,??????????????????????????????
?????????,???????
75
2.???????
??????????????,????????????????????,??????????
????????? ???????????????????
76
???????????? 589,063,269,505,764,182,166,330??
????? key MOD 7,???????3???(??????3),???????
77
??????,?????????????????,???????m,???????
??m-1????,????m????,?????????,???????,??????????
????????,????????????,???????????????
78
3.?????
  • ?????????????,????????????,?????????,????,???????
    ?????
  • ?????????,?????????????????
  • ????????????.

79
4. ????????,??????????????,???????????,???????
????????????????????????,???????????
80
????
?????? ?????????,????????????,????????? ????????
?????????????
81
??????? ????!
Write a Comment
User Comments (0)
About PowerShow.com