Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Merge Sort
Search
KuoE0
March 05, 2013
Programming
1
9.3k
Merge Sort
KuoE0
March 05, 2013
Tweet
Share
More Decks by KuoE0
See All by KuoE0
Protocol handler in Gecko
kuoe0
0
77
面試面試面試,因為很重要所以要說三次!
kuoe0
2
210
應徵軟體工程師
kuoe0
0
150
面試心得分享
kuoe0
0
390
Windows 真的不好用...
kuoe0
0
250
Python @Wheel Lab
kuoe0
0
180
Introduction to VP8
kuoe0
0
200
Python @NCKU_CSIE
kuoe0
0
95
[ACM-ICPC] Tree Isomorphism
kuoe0
1
220
Other Decks in Programming
See All in Programming
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
520
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
230
【Kaigi on Rails 2024】YOUTRUST スポンサーLT
krpk1900
1
330
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
初めてDefinitelyTypedにPRを出した話
syumai
0
410
Less waste, more joy, and a lot more green: How Quarkus makes Java better
hollycummins
0
100
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
弊社の「意識チョット低いアーキテクチャ」10選
texmeijin
5
24k
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
170
Featured
See All Featured
Statistics for Hackers
jakevdp
796
220k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
720
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
What's in a price? How to price your products and services
michaelherold
243
12k
Agile that works and the tools we love
rasmusluckow
327
21k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
The World Runs on Bad Software
bkeepers
PRO
65
11k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
Automating Front-end Workflow
addyosmani
1366
200k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Designing Experiences People Love
moore
138
23k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Transcript
Merge Sort ֲࢸݢʢKuoE0ʣ
[email protected]
KuoE0.ch
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) http://creativecommons.org/licenses/by-sa/3.0/ Latest update: Mar
6, 2013
Traditional Merge Sort
Algorithm ࠾༻ divide & conquer ࡦུ
Divide ሡᙛલᏐྻሣׂᬇਐߦ ౸ᷮႫҰݸݩૉ
2 9 4 3 8 7 5 1 6 2
9 4 3 8 7 5 1 6 2 9 4 3 8 7 5 1 6 2 9 4 8 3 5 7 6 1 9 2
Conquer 1. ར༻ၷݸࢦඪࢦၷݸ༗ংᏐྻ A ᢛ B 2. ൺֱࢦඪࢦతᏐ值 3. ሡֱখతᏐ值์ೖ৽తᏐྻ
Cɼฒሡ֘ࢦඪ ࢦԼҰᏐ值 4. ౸ҰࢦඪࢦᏐྻ݁ඌɼሡ㠥ҰᏐྻႫ ᰨతᏐ值์ೖᏐྻ C
Merge Two Sequence 9 8 7 6 5 4 3
2 1
Merge Two Sequence 9 8 7 6 5 4 3
2 1
Merge Two Sequence 9 8 7 6 5 4 3
2 1
Merge Two Sequence 9 8 7 6 5 4 3
2 1
Merge Two Sequence 9 8 7 6 5 4 3
2 1
Merge Two Sequence 9 8 7 6 5 4 3
2 1
Merge Two Sequence 9 8 7 6 5 4 3
2 1
Merge Two Sequence 9 8 7 6 5 4 3
2 1
Merge Two Sequence 9 8 7 6 5 4 3
2 1
Merge Two Sequence 9 8 7 6 5 4 3
2 1
1 2 3 4 5 6 7 8 9 2
3 4 8 9 1 5 6 7 2 4 9 3 8 5 7 1 6 2 9 4 8 3 5 7 6 1 9 2
Natural Merge Sort
Key Point ར༻Ꮠྻதత༗ংᏐྻยஈɼҎݮগׂ࣍Ꮠʂ
༗ংᏐྻยஈ 1 3 4 2 7 9 8 0 5
1 3 4 2 7 9 8 0 5
How to Divide 1 3 4 2 7 9 8
0 5 A B
How to Divide 1 3 4 2 7 9 8
0 5 A B 1
How to Divide 1 3 4 2 7 9 8
0 5 A B 1
How to Divide 1 3 4 2 7 9 8
0 5 A B 1 3
How to Divide 1 3 4 2 7 9 8
0 5 A B 1 3
How to Divide 1 3 4 2 7 9 8
0 5 A B 1 3 4
How to Divide 1 3 4 2 7 9 8
0 5 A B 1 3 4
How to Divide 1 3 4 2 7 9 8
0 5 A B 1 3 4 1 3 4
How to Divide 1 3 4 2 7 9 8
0 5 A B 1 3 4 1 3 4 2
How to Divide 1 3 4 2 7 9 8
0 5 A B 1 3 4 1 3 4 2
How to Divide 1 3 4 2 7 9 8
0 5 A B 1 3 4 1 3 4 2 7
How to Divide 1 3 4 2 7 9 8
0 5 A B 1 3 4 1 3 4 2 7
How to Divide 1 3 4 2 7 9 8
0 5 A B 1 3 4 1 3 4 2 7 9
How to Divide 1 3 4 2 7 9 8
0 5 A B 1 3 4 1 3 4 2 7 9
How to Divide 1 3 4 2 7 9 8
0 5 A B 1 3 4 1 3 4 2 7 9 2 7 9
How to Divide 1 3 4 2 7 9 8
0 5 A B 1 3 4 1 3 4 2 7 9 2 7 9 8
How to Divide 1 3 4 2 7 9 8
0 5 A B 1 3 4 1 3 4 2 7 9 2 7 9 8
How to Divide 1 3 4 2 7 9 8
0 5 A B 1 3 4 1 3 4 2 7 9 2 7 9 8 8
How to Divide 1 3 4 2 7 9 8
0 5 A B 1 3 4 1 3 4 2 7 9 2 7 9 8 8 0
How to Divide 1 3 4 2 7 9 8
0 5 A B 1 3 4 1 3 4 2 7 9 2 7 9 8 8 0
How to Divide 1 3 4 2 7 9 8
0 5 A B 1 3 4 1 3 4 2 7 9 2 7 9 8 8 0 5
How to Divide 1 3 4 2 7 9 8
0 5 A B 1 3 4 1 3 4 2 7 9 2 7 9 8 8 0 5
How to Divide 1 3 4 2 7 9 8
0 5 A B 1 3 4 1 3 4 2 7 9 2 7 9 8 8 0 5 0 5
The merge operation is as same as traditional merge sort.
End