??????(p.161) - PowerPoint PPT Presentation

About This Presentation
Title:

??????(p.161)

Description:

14 – PowerPoint PPT presentation

Number of Views:14
Avg rating:3.0/5.0
Slides: 19
Provided by: Atsus4
Category:
Tags: boyer | moore

less

Transcript and Presenter's Notes

Title: ??????(p.161)


1
????????????
  • ?14?
  • ??????

2
?????
  • ??????(p.161)
  • ??
  • ?????

3
C??????
  • ?????
  • ??????
  • ????(NULL??)???
  • ??? hello ??????????????????????
  • char str6 h, e, l, l, o, \0
  • char str6 hello ? ?????????
  • 5???????????????6?????????

????
h
e
l
l
o
\0
4
??????(??)
  • ?????????????????
  • ???????????????????????????

????babcabaabaacaabaa
????abaa
5
???????
  • n???????(src0srcn-1)???m???????(pat0patm-
    1)????????????

src
h
o
y
p
c
n
h
o
d
a
r
i
\0
pat
\0
c
h
o
6
?????
  • src ?0???m-1?????pat?????????

src
pat
  • src ?1???m?????pat?????????

src
h
o
y
p
c
n
h
o
d
a
r
i
\0
pat
\0
c
h
o
  • ????????? pat ?1???????????

src
h
o
y
p
c
n
h
o
d
a
r
i
\0
pat
c
h
o
\0
7
?????????
  • ????? n?????? m
  • ??? O(mn)
  • ???????????????????????(m?????c?????)??O(cn)
    O(n)

8
BM(Boyer-Moore)?
  • ???????????????????
  • ??????????????????????????????????????? ?
    2??????????????
  • ?????????????????????????????????????????(?d)
  • ??????????????????????????????????????????????????
    ??(?e)

9
BM??????
  • ????p??????????????????????
  • pj ???? j m-1, m-2 ????? (m?p????)

i
t
e
p
k
o
g
e
h
o
g
e
j ( 7)
i
t
e
g
p
k
o
g
e
h
o
g
e
j ( 6)
10
BM???????1
  • ???????????????????????????????? d ??????? (???
    6.22?)
  • ????????????????????????
  • ?????????????????? -1
  • ????? kogehoge ???

p
k
o
g
e
h
o
g
e
a b c d e f g h i j k o
-1 -1 -1 -1 7 -1 6 4 -1 0 5
11
BM???????1
  • ?????????max1, j-d(ti) ??????
  • d(a) -1 (?????a??????)s max1, 5 (-1)
    6

t
e
a
g
p
k
o
g
e
h
o
g
e
j ( 5)
t
e
a
g
p
k
o
g
e
h
o
g
e
12
BM???????2
  • e( j ) min s pl pl s, l m1,
    m2,..., max j1, s , ??? j s ? 0
    ???? pj ? pj s
  • ??????????? (??? 6.23?)
  • e(j)?????????????????????????????????????????????!
    ????

j
0
1
2
3
4
5
6
7
p
k
o
g
e
h
o
g
e
e(j)
8
8
8
8
4
8
8
1
13
BM???????2(?1)
????
??????!
e
?
g
k
o
g
e
h
o
g
e
j ( 5)
k
o
g
e
h
o
g
e
j
0
1
2
3
4
5
6
7
p
k
o
g
e
h
o
g
e
e(j)
8
8
8
8
4
8
8
1
14
BM???????2 (?2)
????
??????!
?
e
o
g
k
o
g
e
h
o
g
e
j ( 4)
k
o
g
e
h
o
g
e
j
0
1
2
3
4
5
6
7
p
k
o
g
e
h
o
g
e
e(j)
8
8
8
8
4
8
8
1
15
????????????? e(j) ??
j
j
0
1
2
3
4
5
6
7
0
1
2
3
a
b
c
d
e
a
b
c
a
b
a
a
e(j)
e(j)
5
5
5
5
5
8
8
1
3
3
1
2
j
j
0
1
2
3
4
5
6
7
0
1
2
3
4
5
6
7
a
a
a
a
a
a
a
a
a
b
c
d
e
c
d
e
e(j)
e(j)
1
2
3
4
5
6
7
8
8
8
8
8
3
8
8
1
16
Boyer-Moore? (???)
  • ???????????
  • ???????????2?????????????????
  • s max j d(ti), e(j)
  • d(ti) ??????????src?????????????
  • e(j) ??????????????????????????
  • Boyer-Moore?????
  • ????? O(n)
  • ????? O(n/m)

17
????????
  • ??8/2(?) 10?30?12?
  • ????????
  • ???,????????????
  • ????????????
  • ?????????,???????????,????,??,?????
  • ?????????
  • ?????????????

18
????????
  • ??????2/3?(9?)???????????????????????(????)
  • ????????????????(?? 37)
  • ?????????????100??????
  • ?80???
  • ?70???80???
  • ?60???70???
Write a Comment
User Comments (0)
About PowerShow.com