Submit Search
Upload
Heap
•
Download as PPTX, PDF
•
0 likes
•
86 views
T
takutori
Follow
this is slide about heap structure.
Read less
Read more
Engineering
Report
Share
Report
Share
1 of 38
Download now
Recommended
kagamicomput201809
kagamicomput201809
swkagami
機械学習アルゴリズムの絵本
機械学習アルゴリズムの絵本
Hirokazu Nishio
3D描画基礎知識
3D描画基礎知識
AimingStudy
slackの会話ネットワークの分析、及びチャネル内活性化指標の提案
slackの会話ネットワークの分析、及びチャネル内活性化指標の提案
takutori
Slack data Analysis
Slack data Analysis
takutori
Deep learning _linear_algebra___probablity___information
Deep learning _linear_algebra___probablity___information
takutori
T-sne
T-sne
takutori
Prml 最尤推定からベイズ曲線フィッティング
Prml 最尤推定からベイズ曲線フィッティング
takutori
Recommended
kagamicomput201809
kagamicomput201809
swkagami
機械学習アルゴリズムの絵本
機械学習アルゴリズムの絵本
Hirokazu Nishio
3D描画基礎知識
3D描画基礎知識
AimingStudy
slackの会話ネットワークの分析、及びチャネル内活性化指標の提案
slackの会話ネットワークの分析、及びチャネル内活性化指標の提案
takutori
Slack data Analysis
Slack data Analysis
takutori
Deep learning _linear_algebra___probablity___information
Deep learning _linear_algebra___probablity___information
takutori
T-sne
T-sne
takutori
Prml 最尤推定からベイズ曲線フィッティング
Prml 最尤推定からベイズ曲線フィッティング
takutori
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
More Related Content
Featured
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Featured
(20)
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
Skeleton Culture Code
Skeleton Culture Code
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
How to have difficult conversations
How to have difficult conversations
Introduction to Data Science
Introduction to Data Science
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
The six step guide to practical project management
The six step guide to practical project management
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Heap
1.
データ構造 立命館大学理工学部数理科学科三回生 谷口泰地
2.
目次 •木、二分木 •プライオリティキュー、 ヒープ •応用問題
3.
データ構造って??
4.
データ構造とはデータの持ち方のことである。 保存の方法 自分が行う処理に適したデータの持ち方を選ぶ
5.
データ構造の前にまずは、「木」から
6.
「木」とはグラフ理論で出てくるグラフの一種 By wiki グラフ…nodeとedgeの集合からなる空間 無向…edgeに向きがない 閉路…逆戻りせず一周回ってこれる道 連結…一方のnodeから別のnodeへedgeを通って移動できる 数学、特にグラフ理論の分野における木(き、英: tree)とは、 連結で閉路を持たない(無向)グラフである。 nodeの一つ edgeの一つ
7.
?????
8.
nodeの一つ edgeの一つ 一般的なグラフ 閉路がある Edgeに向きがある 連結…どの二点間にも道がある。
9.
•閉路がない •向きがない •連結 木
10.
根付き木 根 基準 親 子 兄弟
11.
二分木…一つのnodeに引っ付いているedgeが二つ以下
12.
データ構造は自分が行いたい処理 に適したものを選ぶ
13.
データ構造:プライオリティキュー やりたい処理 • 数を追加する • 最小の数値を取り出す 1,2,4
1,2,3,4 1,2,3,4 2,3,4 1を取り出す 3を追加
14.
データ構造:プライオリティキュー やりたい処理 • 数を追加する • 最小の数値を取り出す 二分木を使うと便利! (二分)ヒープと呼ばれる
15.
ヒープ • 親のほうが若い • 左にノードが詰まっている 特徴
16.
ヒープ 1. 数字の追加 2. 最小値の取り出し
17.
ヒープ 1. 数字の追加 2. 最小値の取り出し 一番下の段のでき るだけ左に付ける
18.
ヒープ 1. 数字の追加 2. 最小値の取り出し 自分より年寄りの親が いなくなるまで親と入 れ替える
19.
ヒープ 1. 数字の追加 2. 最小値の取り出し ヒープ構造の維持!
20.
ヒープ 1. 数字の追加 2. 最小値の取り出し
21.
ヒープ 1. 数字の追加 2. 最小値の取り出し 根の値を取り出す A
22.
ヒープ 1. 数字の追加 2. 最小値の取り出し 根に最後尾の nodeをコピー
23.
ヒープ 1. 数字の追加 2. 最小値の取り出し 最後尾のnodeを 削除
24.
ヒープ 1. 数字の追加 2. 最小値の取り出し 逆転がなくなる まで小さい方と 入れ替える
25.
ヒープ 1. 数字の追加 2. 最小値の取り出し ヒープ構造の維持!
26.
ヒープ構造の実装 • ポイント 1. 上からかつ左から順にノードに番号を 付ける 2.
自分(n番目)の子のうち、左のノード の番号は2*n+1 3. 自分(n番目)の子のうち、右のノード の番号は2*n+2
27.
ヒープ構造の実装 A GH FB C D
E
28.
ヒープ構造の実装 • Pythonを使った実装を行いました。 • クラスを使ってヒープ構造を保存しました。 •
https://github.com/takutori/Implementation /tree/master/Pro_con を見てねっ!!
29.
ヒープ構造に追加され て削除されていく様
30.
ヒープソート ヒープ構造の「最小を取り出 す」操作を用いて、配列を小 さい順に並び変える。
31.
ヒープの応用問題 • 問題文 ドラックで距離Lの道を移動します。初めトラック にはガソリンがP積まれています。このトラックは 距離1走るとガソリン1減る。途中でガソリンが0に なってしまうとトラックは停止し、移動に失敗する。 途中にガソリンスタンドはN個あり、各ガソリンス タンドiはのスタート点から距離A_1の地点にあり、 B_iだけガソリンを補給できる。トラックは移動を 完了できるか?その際、最小で何回のガソリンの補 給が必要か?完了できる場合は最小の補給回数を、 できない場合は-1を出力せよ。 1<=N<=10000 1<=L<=1000000 1<=P<=1000000 1<=A_1<L 1<=B_i<100
32.
解き方 1. トラックを走らせる 2. 通ったガソスタを記憶 3.
トラックガス欠 4. 通ってたガソスタの中で一番給油できる量を給油 5. ゴールするまで1に戻る、通ったガソスタをすべて使ってしまっ たらアウト
33.
解き方 1. トラックを走らせる 2. 通ったガソスタを記憶 3.
トラックガス欠 4. 通ってたガソスタの中で一番給油できる量を給油 5. ゴールするまで1に戻る、通ったガソスタをすべて使ってしまっ たらアウト
34.
解き方 1. トラックを走らせる 2. 通ったガソスタを記憶 3.
トラックガス欠 4. 通ってたガソスタの中で一番給油できる量を給油 5. ゴールするまで1に戻る、通ったガソスタをすべて使ってしまっ たらアウト
35.
解き方 1. トラックを走らせる 2. 通ったガソスタを記憶 3.
トラックガス欠 4. 通ってたガソスタの中で一番給油できる量を給油 5. ゴールするまで1に戻る、通ったガソスタをすべて使ってしまっ たらアウト これ!!!
36.
解き方 1. トラックを走らせる 2. 通ったガソスタを記憶 3.
トラックガス欠 4. 通ってたガソスタの中で一番給油できる量を給油 5. ゴールするまで1に戻る、通ったガソスタをすべて使ってしまっ たらアウト
37.
解き方 ポイント! 通ったガソスタの給油量をヒープ構造で保管し、ガ ス欠するたびにヒープ構造から最大値を取り出す。 実装はhttps://github.com/takutori/Implementation/tree/master/Pro_conを見てね!
Editor's Notes
こうゆう人いますか???汗
Download now