Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
201812_StringBeginners_OPPM_Shawna
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Shawna
December 07, 2018
90
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
201812_StringBeginners_OPPM_Shawna
StringBeginners(
https://sites.google.com/view/stringbeginners/workshop
) にて発表
Shawna
December 07, 2018
More Decks by Shawna
See All by Shawna
201909_StringBeginners_Palindrome_Shawna
shiho_tksam
0
90
Featured
See All Featured
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
330
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
400
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
280
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
What the history of the web can teach us about the future of AI
inesmontani
PRO
2
740
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
570
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.3k
For a Future-Friendly Web
brad_frost
184
10k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
ラッコキーワード サービス紹介資料
rakko
1
5.3M
Skip the Path - Find Your Career Trail
mkilby
1
260
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Transcript
元 HABATAKITAI Laboratory Everything is String. 元 Order Preserving Pattern
Matching (順序同型文字列照合) ~ of the beginners, by the beginners, for the beginners ~ Shawna 1
HABATAKITAI Laboratory Everything is String. 元 HABATAKITAI Laboratory Everything is
String. • 文字列が一致しているか? • 文字列が一致していないか? 2 Matching ?
HABATAKITAI Laboratory Everything is String. 元 HABATAKITAI Laboratory Everything is
String. • テキストとして与えられた文字列の中から,パターンと して与えられた文字列と一致する部分文字列を探し出す 問題を,文字列照合問題と呼ぶ. • 文字列 3 Pattern Matching
HABATAKITAI Laboratory Everything is String. 元 HABATAKITAI Laboratory Everything is
String. • テキストとして与えられた文字列の中から,パターンと して与えられた文字列と一致する部分文字列を探し出す 問題を,文字列照合問題と呼ぶ. • 文字列 4 Pattern Matching
HABATAKITAI Laboratory Everything is String. 元 HABATAKITAI Laboratory Everything is
String. • 文字列 poppippo のオートマトンの例 5 KMP 法による解法 T P P p p p p p o o i
HABATAKITAI Laboratory Everything is String. 元 HABATAKITAI Laboratory Everything is
String. • 長さ n のテキストと長さ m のパターンが与えられたとき, テキスト上のパターンの全出現位置を O(m+n) 時間で列 挙できる. 6 KMP 法による解法
HABATAKITAI Laboratory Everything is String. 元 HABATAKITAI Laboratory Everything is
String. • 長さの同じ2つの文字列 x と y が順序同型である(以降, x ≈ y と記述)とは, 任意の i, j (1 ≤ i, j ≤ |x|)について,x[i] ≤ x[j] ⇔ y[i] ≤ y[j]を 満たすことである. 7 Order Preserving Matching ?
HABATAKITAI Laboratory Everything is String. 元 HABATAKITAI Laboratory Everything is
String. • 大きさの順番が同じだったら,一致する!(ざっくり) • 4 1 4 7 3 5 2 3 4 7 1 7 9 5 8 4 5 7 8 Order Preserving Matching ? ① ②③ ③ ④ ④ ④ ⑤ ⑥ ① ②③ ③ ④ ④ ④ ⑤ ⑥ = ≈
HABATAKITAI Laboratory Everything is String. 元 HABATAKITAI Laboratory Everything is
String. • 順序同型であるとは,どういうことか…? • x[1..i] ≈ y[1..i] としたとき,x[1..i+1] ≈ y[1..i+1]となる条件 は, x[i+1] 以上で最も小さい値を x[k] (1 ≤ k ≤ i) としたとき, y[i+1] ≤ y[k] を満たすかつ, x[i+1] 以下で最も大きい値を x[l] (1 ≤ l ≤ i) としたとき, y[i+1] ≥ y[l] を満たすことである. 9 Order Preserving Matching x y i m m M M x y ③⑤④②⑥① 4 6 5 2 9 1 4 7 5 3 9 1 ③⑤④②⑥① 8 8
HABATAKITAI Laboratory Everything is String. 元 HABATAKITAI Laboratory Everything is
String. • 順序同型であるとは,どういうことか…? • x[1..i] ≈ y[1..i] としたとき,x[1..i+1] ≈ y[1..i+1]となる条件 は, x[i+1] 以上で最も小さい値を x[k] (1 ≤ k ≤ i) としたとき, y[i+1] ≤ y[k] を満たすかつ, x[i+1] 以下で最も大きい値を x[l] (1 ≤ l ≤ i) としたとき, y[i+1] ≥ y[l] を満たすことである. 10 Order Preserving Matching x y i m m M M x y ③⑤④②⑥① 4 6 5 2 9 1 4 7 5 3 9 1 ③⑤④②⑥① 8 8
HABATAKITAI Laboratory Everything is String. 元 HABATAKITAI Laboratory Everything is
String. • テキストとして与えられた文字列の中から,パターンと して与えられた文字列と順序同型である部分文字列を探 し出す問題を,文字列照合問題と呼ぶ. • テキスト T 上でパターン P と順序同型になる部分文字列 (T[i..i+|P|-1] ) 11 Order Preserving Pattern Matching
HABATAKITAI Laboratory Everything is String. 元 HABATAKITAI Laboratory Everything is
String. • LMaxP [i] : P[k] ≤ P[i] かつ 1 ≤ k ≤ i-1 を満たす最大値の位置. • LMinP [i] : P[k] ≥ P[i] かつ 1 ≤ k ≤ i-1 を満たす最小値の位置. • パターンをソートすればよい. O(m log m) 時間 – 整数アルファベットでは,O(m) 時間 • 文字列一致と同様に,オートマトンを構築する. 12 KMPによる解法
HABATAKITAI Laboratory Everything is String. 元 HABATAKITAI Laboratory Everything is
String. • 例)文字列 1 5 2 4 3 のオートマトンとLMax,LMin 13 KMPによる解法 5 1 2 4 3 0 0 1 0 1 2 3 2 3 2 LMax LMin
HABATAKITAI Laboratory Everything is String. 元 HABATAKITAI Laboratory Everything is
String. • 長さ n のテキストと長さ m のパターンが与えられたとき, テキスト上でパターンと順序同型な文字列の全出現位置 を O(m+n) 時間で列挙できる. 14 KMP による解法