Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
2021-02-implicit-static-finger-search
kgoto
February 12, 2021
Research
0
65
2021-02-implicit-static-finger-search
StringBeginners #15
https://sites.google.com/view/stringbeginners/workshop/2021/2021-02-10-online
kgoto
February 12, 2021
Tweet
Share
More Decks by kgoto
See All by kgoto
SATソルバを用いたNP困難な圧縮指標の高速計算
kgoto
0
17
BW Transform of Thue-Morse Words
kgoto
0
45
In-Place BW Transform
kgoto
0
8
Many Words with Many Palindromes
kgoto
0
47
Conjugate Palindromes
kgoto
0
13
2019-08-psc-optimal-construction-of-suffix-arrays-and-lcp-arrays
kgoto
0
84
2019-06-space-efficient-graph-search
kgoto
0
45
2018-12-stringbeginners-in-place-array-rotation
kgoto
0
110
2018-11-stringbeginners-haruhi-problem-superpermutation
kgoto
1
420
Other Decks in Research
See All in Research
【IR Reading2022秋】 CPFair: Personalized Consumer and Producer Fairness Re-ranking for Recommender Systems
yamato0811
1
110
[IR Reading 2022秋 論文紹介] Price DOES Matter!: Modeling Price and Interest Preferences in Session-based Recommendation (SIGIR 2022) /IR-Reading-2022-fall
koheishinden
2
100
[CFML勉強会#7] EconMLに実装されている異質処置効果の推定手法の紹介・再考
fullflu
0
410
正確な推薦は無条件に信頼できるか?
kuri8ive
3
630
研究のやり方,論文の書き方
kanojikajino
7
4.1k
Making oRAT, Go
patrickwardle
0
700
ABEMAにおけるサムネイル検証とOPE活用
ebisawahayata
1
840
Openproxy型ハニーポット「Proxypot」
tatsui
0
190
第20回チャンピオンズミーティング・サジタリウス杯ラウンド1集計 / Umamusume Sagittarius 2022 Round1
kitachan_black
0
620
福岡ジャズ界のために個人サービスを開発/運営して学んだこと
daichan4649
0
270
[IR Reading 2022秋 論文紹介] Expressions Causing Differences in Emotion Recognition in Social Networking Service Documents (CIKM'22) / IR Reading 2022 Autumn
shunk031
1
440
KWJA:汎用言語モデルに基づく日本語解析器 / kyoto-waseda-japanese-analyzer
nobug
5
1.3k
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
314
35k
Art Directing for the Web. Five minutes with CSS Template Areas
malarkey
196
9.8k
Side Projects
sachag
451
37k
Three Pipe Problems
jasonvnalue
89
8.9k
Facilitating Awesome Meetings
lara
33
4.6k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
13
1.1k
How GitHub Uses GitHub to Build GitHub
holman
465
280k
How to Ace a Technical Interview
jacobian
270
21k
Designing Experiences People Love
moore
130
22k
The Web Native Designer (August 2011)
paulrobertlloyd
76
2.2k
Thoughts on Productivity
jonyablonski
49
2.7k
Docker and Python
trallard
30
1.9k
Transcript
強暗黙静的指探索 Strong Implicit Static Finger Search StringBeginners #15 – online
Feb 10, 2021 @kgoto 0
発表の概要 1 ◼省領域データ構造の究極系である 強暗黙データ構造 (strong implicit data structures)を 指探索(finger search)を通して学ぶ
◼強暗黙データ構造を学ぶとここがうれしい! 領域をケチる実用的なテクニック・考え方が学べる 良い問題設定の方法について学べる • なにを前提とするか • 性能の測り方の基準 などなど
省領域データ構造の分類 2 ◼あるデータの保存に必要な情報量下限をZとしたとき データ構造を使用領域によって分類する 小領域(Compact): O(Z) bits 簡潔(Succinct): Z +
o(Z) bits 暗黙(Implicit): Z + O(1) bits https://ja.wikipedia.org/wiki/簡潔データ構造 明確な同意はない 本発表では以下の定義を採用する [Nielsen, 2015] 強暗黙: Z bits 弱暗黙: Z bits + O(1) words
強暗黙データ構造 3 ◼計算モデルはRAMモデル 要素の比較、swapをコスト1で実行する 配列Aとn=|A|は領域にカウントしない ◼Query間でA, n以外は保存しない Query中はO(1)のレジスタ(word)が使用可能
暗黙データ構造の例: Binary heap 4 ◼heap制約を満たす完全二分木の配列表現 *heap制約:各ノードは子より大きい 0 1 2 3
4 5 6 7 8 100 19 36 17 3 25 1 2 7 = A[i]の子はA[2i+1], A[2i+2] 保存するのは値を格納した配 列のみ(自明な情報量下限) 発表でn log U(ここでデータ構造は[0, U-1]の整数値を保存するとする)は 情報量下限でないのではというツッコミあり。log U C n では?
暗黙データ構造の例: Binary heap 5 ◼Binary heapは以下の操作をサポートする add(x): xを追加する pop(): 最大値を削除する
0 1 2 3 4 5 6 7 8 100 19 36 17 3 25 1 2 7 = O(log n) time O(log n) time
暗黙データ構造の例: Binary heap 6 pop 100 0 1 2 3
4 5 6 7 8 100 19 36 17 3 25 1 2 7 popはrootを取り出し、A[n-1]をrootに移動したあとheap制約 を満たすように左右いずれかの子とswapを繰り返す
暗黙データ構造の例: Binary heap 7 36 25 7 0 1 2
3 4 5 6 7 8 36 19 25 17 3 7 1 2 - popはrootを取り出し、A[n-1]をrootに移動したあとheap制約 を満たすように左右いずれかの子とswapを繰り返す O(log n)時間で実行可能 addも同様の時間で計算可能
指探索(finger search) 8 ◼finger searchはfinger propertyを持ち、 以下の操作を提供する辞書データ構造 search(x): xが含まれるかyes/noを返す change_finger(x):
fingerをxに変更する ある要素をfingerとして、search(x)の計算時間が fingerとxとのランク距離tに依存する finger property 要素の追加、削除をサポートする動的なバージョンもあるが今回は静的な場合のみを考える
弱暗黙指探索 9 ◼ データをソートして配列で保存、fingerの位置を保存 O(log N) bits search(x): fingerを起点として指数探索を行う O(log
t)時間 • ① x≦A[rank(f)+2i]を満たす最小のiを求める • ② A[rank(f), rank(f)+ 2i]を二分探索 強暗黙指探索ではfingerを保存できないのでこの方法は使えない f x
強暗黙静的指探索は難しいぞ 10 ◼素朴な発想:fingerの位置を固定する ソート済み配列をrotationしてfingerを先頭に持ってくる searchは高速 O(log t) time change_fingerが大変 O(n)
time searchとchange_fingerのトレードオフを考慮 して効率良いデータ構造を考える必要あり
強暗黙静的指探索 11 q(t, n) ∈ Ω(log n) s.t. • q(t,
n)≧log t • q(0, n)<log (n/2) • q(t, n)はt, nについて単調非減少 Δ=Zq(n) = min{t ∈[1, n]|q(t, n)≧log (n/2)} • qがtだけの関数ならZq(n) = q-1(log (n/2)) ◼q(t, n)=(1/ε) log t for 0<ε≦1とすると change_searchはO(nε)時間 searchをO(q(t, n))時間、change_searchをO(Δ+log n)時間でサ ポートする強暗黙指探索データ構造が存在する 定理 [Brodal+, 2012] qはトレードオフパラメータ この計算時間は最適であることが証明されている(今回は省略)
メモリレイアウト 12 ◼ソート済み配列Aにおいてf近傍A[rank(f)-Δ, rank(f)+Δ]を A[Δ+1]=fになるようにAの先頭に移動する ソート済み配列A fの位置の場合分けは4つある fが必ずA[Δ+1]に来るので 位置を覚えておく必要なし 図:Implicit
Data Structures, Sorting, and Text Indexing
データ境界の計算 13 ◼各データ境域を知ることが重要 ◼P内部のデータ境界はO(log Δ)時間で計算可能 任意の値はfより小さい 任意の値はfより大きい O内部のデータ境界も同様の方法でO(log n)時間で計算可能
データ境界の計算 14 ◼O内部のデータ境界はO(log n)時間で計算可能 case 3, 4はPの左端、右端とfの大小をチェック case 2はcase 1の特殊系と考える
case 1における境界の求め方。 A[Δ+1]のpredecessorがl2の右端、l2の右端のsuccessorを計算する
change_finger 15 ◼左(ソート済み配列)から右へO(Δ)回のswapで変換可能 change_fingerはソート済み配列へrevertして同様の処理を行う (Caseの判定とデータ境界の計算が必要)O(Δ+log n)時間
search(x) 16 ◼P領域でfを起点として指数探索 t≦Δかつxを含むならxはP領域にある O(log t) 時間 ◼見つからなければその他の領域をそれぞれ二分探索する 二分探索によりO(log n)時間で見つかる
search(x) 17 ◼P領域でfを起点として指数探索 t≦Δかつxを含むならxはP領域にある O(log t)∈O(q(t, n))時間 ◼見つからなければその他の領域をそれぞれ二分探索する 二分探索によりO(log n)時間で見つかる
ここでt>ΔよりO(log n)∈O(q(t, n)) searchをO(q(t, n))時間、change_searchをO(Δ+log n)時間で サポートする強暗黙指探索データ構造が存在する 定理 [Brodal+, 2012] q(t, n)≧log tより Δの定義とqはtに対して単調非減少より Δ = min{t ∈[1, n]|q(t, n)≧log (n/2)}