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.4k
Merge Sort
KuoE0
March 05, 2013
Tweet
Share
More Decks by KuoE0
See All by KuoE0
Protocol handler in Gecko
kuoe0
0
96
面試面試面試,因為很重要所以要說三次!
kuoe0
2
240
應徵軟體工程師
kuoe0
0
160
面試心得分享
kuoe0
0
410
Windows 真的不好用...
kuoe0
0
280
Python @Wheel Lab
kuoe0
0
200
Introduction to VP8
kuoe0
0
240
Python @NCKU_CSIE
kuoe0
0
120
[ACM-ICPC] Tree Isomorphism
kuoe0
1
250
Other Decks in Programming
See All in Programming
おやつのお供はお決まりですか?@WWDC25 Recap -Japan-\(region).swift
shingangan
0
140
PHPで始める振る舞い駆動開発(Behaviour-Driven Development)
ohmori_yusuke
2
390
PHPでWebSocketサーバーを実装しよう2025
kubotak
0
290
Modern Angular with Signals and Signal Store:New Rules for Your Architecture @enterJS Advanced Angular Day 2025
manfredsteyer
PRO
0
220
AI駆動のマルチエージェントによる業務フロー自動化の設計と実践
h_okkah
0
150
初学者でも今すぐできる、Claude Codeの生産性を10倍上げるTips
s4yuba
16
11k
設計やレビューに悩んでいるPHPerに贈る、クリーンなオブジェクト設計の指針たち
panda_program
6
2.1k
Porting a visionOS App to Android XR
akkeylab
0
470
プロダクト志向なエンジニアがもう一歩先の価値を目指すために意識したこと
nealle
0
130
猫と暮らす Google Nest Cam生活🐈 / WebRTC with Google Nest Cam
yutailang0119
0
120
Quand Symfony, ApiPlatform, OpenAI et LangChain s'allient pour exploiter vos PDF : de la théorie à la production…
ahmedbhs123
0
190
「テストは愚直&&網羅的に書くほどよい」という誤解 / Test Smarter, Not Harder
munetoshi
0
170
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
31
1.3k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
5.9k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
The World Runs on Bad Software
bkeepers
PRO
69
11k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
30
2.1k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Building a Modern Day E-commerce SEO Strategy
aleyda
42
7.4k
KATA
mclloyd
30
14k
How to Think Like a Performance Engineer
csswizardry
25
1.7k
Fireside Chat
paigeccino
37
3.5k
Making the Leap to Tech Lead
cromwellryan
134
9.4k
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