SlideShare a Scribd company logo
1 of 27
Introduction To Algorithms.§11. Hash Tables. 2010 / 06
Why Hash Tables ? ,[object Object]
先頭にあれば… O(1)
末尾にあれば… O(N)
いつもO(1)ぐらいだったら嬉しい,[object Object]
Key と Value の 組合せ
(Key, Value) で 表に格納する
同じKeyだったらどうしよう,[object Object]
出来れば高速で計算して…
F : Data -> { 0, 1, 2, … , M-1 },[object Object]
Example. ,[object Object]
同じ日の人って…そんなにいないはず
M = 7 : 素数
経験的に素数を使う方がいいらしい
数字の総和 mod 7 を 関数に使う,[object Object]
Question. ,[object Object]
チェイン法/クローズドハッシュ法
どんなハッシュ関数がいいのか,[object Object]
チェイン法 ,[object Object],(78/11/4, C) (01/5/12, E) O(1) (87/2/1, B) (85/10/5, A) (68/8/4, C) O(長さ)
§11.2〜 ,[object Object]
一つのチェイン長は平均してn / m = α : 占有率
仮定:ハッシュ関数はすぐ計算出来る O(1)
そのまま挿入出来る or リストをたどる
O( 1 + α ),[object Object]
大前提2. 上手くばらける
Mod: 割り算だけなので高速
(再掲)経験的に素数を使う方がいいらしい,[object Object]

More Related Content

What's hot

アルゴリズム+データ構造勉強会(9)
アルゴリズム+データ構造勉強会(9)アルゴリズム+データ構造勉強会(9)
アルゴリズム+データ構造勉強会(9)
noldor
 
mathemaical_notation
mathemaical_notationmathemaical_notation
mathemaical_notation
Kenta Oono
 

What's hot (13)

アルゴリズムとデータ構造6
アルゴリズムとデータ構造6アルゴリズムとデータ構造6
アルゴリズムとデータ構造6
 
Rustで始める競技プログラミング
Rustで始める競技プログラミングRustで始める競技プログラミング
Rustで始める競技プログラミング
 
関数の最小値を求めることから機械学習へ
関数の最小値を求めることから機械学習へ関数の最小値を求めることから機械学習へ
関数の最小値を求めることから機械学習へ
 
アルゴリズム+データ構造勉強会(9)
アルゴリズム+データ構造勉強会(9)アルゴリズム+データ構造勉強会(9)
アルゴリズム+データ構造勉強会(9)
 
programming camp 2008, introduction of programming, algorithm
programming camp 2008, introduction of programming, algorithmprogramming camp 2008, introduction of programming, algorithm
programming camp 2008, introduction of programming, algorithm
 
圏とHaskellの型
圏とHaskellの型圏とHaskellの型
圏とHaskellの型
 
Haskell勉強会 in ie
Haskell勉強会 in ieHaskell勉強会 in ie
Haskell勉強会 in ie
 
圏論のモナドとHaskellのモナド
圏論のモナドとHaskellのモナド圏論のモナドとHaskellのモナド
圏論のモナドとHaskellのモナド
 
Python勉強会3-コレクションとファイル
Python勉強会3-コレクションとファイルPython勉強会3-コレクションとファイル
Python勉強会3-コレクションとファイル
 
圏論とHaskellは仲良し
圏論とHaskellは仲良し圏論とHaskellは仲良し
圏論とHaskellは仲良し
 
自動定理証明の紹介
自動定理証明の紹介自動定理証明の紹介
自動定理証明の紹介
 
代数的実数とCADの実装紹介
代数的実数とCADの実装紹介代数的実数とCADの実装紹介
代数的実数とCADの実装紹介
 
mathemaical_notation
mathemaical_notationmathemaical_notation
mathemaical_notation
 

Viewers also liked

õPpeinfosüSteemi üHildamine E õPpe Keskkondadega üHe üLikooli õI Si NäItel
õPpeinfosüSteemi üHildamine E õPpe Keskkondadega üHe üLikooli õI Si NäItelõPpeinfosüSteemi üHildamine E õPpe Keskkondadega üHe üLikooli õI Si NäItel
õPpeinfosüSteemi üHildamine E õPpe Keskkondadega üHe üLikooli õI Si NäItel
Maret Mõis
 
Grayling foreign-investment-think-piece june-2011
Grayling foreign-investment-think-piece june-2011Grayling foreign-investment-think-piece june-2011
Grayling foreign-investment-think-piece june-2011
Pavel Melnikov
 
Tenth Draft Dr. Cotter
Tenth Draft Dr. CotterTenth Draft Dr. Cotter
Tenth Draft Dr. Cotter
feoropeza
 
Direccion escolar efectiva_elsalvador
Direccion escolar efectiva_elsalvadorDireccion escolar efectiva_elsalvador
Direccion escolar efectiva_elsalvador
I GARITA
 
What is art?
What is art?What is art?
What is art?
mertxita
 
Think piece pharma 2020 june 2010
Think piece pharma 2020 june 2010Think piece pharma 2020 june 2010
Think piece pharma 2020 june 2010
Pavel Melnikov
 
Presentation
PresentationPresentation
Presentation
s1170006
 
Presentation
PresentationPresentation
Presentation
s1170006
 
Natalia Zubarevich - Russian regions - September 2014
Natalia Zubarevich - Russian regions - September 2014Natalia Zubarevich - Russian regions - September 2014
Natalia Zubarevich - Russian regions - September 2014
Pavel Melnikov
 

Viewers also liked (20)

Presentation missouri
Presentation missouriPresentation missouri
Presentation missouri
 
õPpeinfosüSteemi üHildamine E õPpe Keskkondadega üHe üLikooli õI Si NäItel
õPpeinfosüSteemi üHildamine E õPpe Keskkondadega üHe üLikooli õI Si NäItelõPpeinfosüSteemi üHildamine E õPpe Keskkondadega üHe üLikooli õI Si NäItel
õPpeinfosüSteemi üHildamine E õPpe Keskkondadega üHe üLikooli õI Si NäItel
 
Grayling foreign-investment-think-piece june-2011
Grayling foreign-investment-think-piece june-2011Grayling foreign-investment-think-piece june-2011
Grayling foreign-investment-think-piece june-2011
 
Tenth Draft Dr. Cotter
Tenth Draft Dr. CotterTenth Draft Dr. Cotter
Tenth Draft Dr. Cotter
 
El costo de la anticipación
El costo de la anticipaciónEl costo de la anticipación
El costo de la anticipación
 
Direccion escolar efectiva_elsalvador
Direccion escolar efectiva_elsalvadorDireccion escolar efectiva_elsalvador
Direccion escolar efectiva_elsalvador
 
Meraviglioso
MeravigliosoMeraviglioso
Meraviglioso
 
Virtual team tools
Virtual team toolsVirtual team tools
Virtual team tools
 
Firewall corewp
Firewall corewpFirewall corewp
Firewall corewp
 
Foilsを使ってみた。
Foilsを使ってみた。Foilsを使ってみた。
Foilsを使ってみた。
 
Perkembangan asuransi syariah di indonesia 2012
Perkembangan asuransi syariah di indonesia 2012Perkembangan asuransi syariah di indonesia 2012
Perkembangan asuransi syariah di indonesia 2012
 
Pingüí
PingüíPingüí
Pingüí
 
Social Media Basics
Social Media BasicsSocial Media Basics
Social Media Basics
 
Coworking Europe 2012 París
Coworking Europe 2012 ParísCoworking Europe 2012 París
Coworking Europe 2012 París
 
What is art?
What is art?What is art?
What is art?
 
Think piece pharma 2020 june 2010
Think piece pharma 2020 june 2010Think piece pharma 2020 june 2010
Think piece pharma 2020 june 2010
 
Presentation
PresentationPresentation
Presentation
 
Presentation
PresentationPresentation
Presentation
 
Em
EmEm
Em
 
Natalia Zubarevich - Russian regions - September 2014
Natalia Zubarevich - Russian regions - September 2014Natalia Zubarevich - Russian regions - September 2014
Natalia Zubarevich - Russian regions - September 2014
 

More from Keisuke OTAKI

ベイジアンネットワーク入門
ベイジアンネットワーク入門ベイジアンネットワーク入門
ベイジアンネットワーク入門
Keisuke OTAKI
 

More from Keisuke OTAKI (14)

KDD読み会(図なし版)
KDD読み会(図なし版)KDD読み会(図なし版)
KDD読み会(図なし版)
 
Reading Seminar (140515) Spectral Learning of L-PCFGs
Reading Seminar (140515) Spectral Learning of L-PCFGsReading Seminar (140515) Spectral Learning of L-PCFGs
Reading Seminar (140515) Spectral Learning of L-PCFGs
 
一階述語論理のメモ
一階述語論理のメモ一階述語論理のメモ
一階述語論理のメモ
 
Grammatical inference メモ 1
Grammatical inference メモ 1Grammatical inference メモ 1
Grammatical inference メモ 1
 
ベイジアンネットワーク入門
ベイジアンネットワーク入門ベイジアンネットワーク入門
ベイジアンネットワーク入門
 
Tensor Decomposition and its Applications
Tensor Decomposition and its ApplicationsTensor Decomposition and its Applications
Tensor Decomposition and its Applications
 
Ada boost
Ada boostAda boost
Ada boost
 
PRML§12-連続潜在変数
PRML§12-連続潜在変数PRML§12-連続潜在変数
PRML§12-連続潜在変数
 
Prml sec6
Prml sec6Prml sec6
Prml sec6
 
ウェーブレット勉強会
ウェーブレット勉強会ウェーブレット勉強会
ウェーブレット勉強会
 
Prml sec3
Prml sec3Prml sec3
Prml sec3
 
Sec16 greedy algorithm no2
Sec16 greedy algorithm no2Sec16 greedy algorithm no2
Sec16 greedy algorithm no2
 
Sec16 greedy algorithm no1
Sec16 greedy algorithm no1Sec16 greedy algorithm no1
Sec16 greedy algorithm no1
 
Sec15 dynamic programming
Sec15 dynamic programmingSec15 dynamic programming
Sec15 dynamic programming
 

Recently uploaded

Recently uploaded (11)

論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
 
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
 
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
 
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
 
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
 
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
 
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
 
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
 
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
 
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native IntegrationsUtilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
 

Hash Table