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
78
面試面試面試,因為很重要所以要說三次!
kuoe0
2
210
應徵軟體工程師
kuoe0
0
150
面試心得分享
kuoe0
0
390
Windows 真的不好用...
kuoe0
0
260
Python @Wheel Lab
kuoe0
0
180
Introduction to VP8
kuoe0
0
200
Python @NCKU_CSIE
kuoe0
0
96
[ACM-ICPC] Tree Isomorphism
kuoe0
1
220
Other Decks in Programming
See All in Programming
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
4
230
「Chatwork」Android版アプリを 支える単体テストの現在
okuzawats
0
180
これでLambdaが不要に?!Step FunctionsのJSONata対応について
iwatatomoya
2
3.6k
htmxって知っていますか?次世代のHTML
hiro_ghap1
0
330
暇に任せてProxmoxコンソール 作ってみました
karugamo
1
720
ドメインイベント増えすぎ問題
h0r15h0
1
230
第5回日本眼科AI学会総会_AIコンテスト_3位解法
neilsaw
0
170
これが俺の”自分戦略” プロセスを楽しんでいこう! - Developers CAREER Boost 2024
niftycorp
PRO
0
190
Jakarta EE meets AI
ivargrimstad
0
240
わたしの星のままで一番星になる ~ 出産を機にSIerからEC事業会社に転職した話 ~
kimura_m_29
0
180
Fibonacci Function Gallery - Part 1
philipschwarz
PRO
0
210
rails stats で紐解く ANDPAD のイマを支える技術たち
andpad
1
290
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
Statistics for Hackers
jakevdp
796
220k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
KATA
mclloyd
29
14k
Become a Pro
speakerdeck
PRO
26
5k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
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