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
81
面試面試面試,因為很重要所以要說三次!
kuoe0
2
220
應徵軟體工程師
kuoe0
0
150
面試心得分享
kuoe0
0
400
Windows 真的不好用...
kuoe0
0
260
Python @Wheel Lab
kuoe0
0
190
Introduction to VP8
kuoe0
0
210
Python @NCKU_CSIE
kuoe0
0
100
[ACM-ICPC] Tree Isomorphism
kuoe0
1
230
Other Decks in Programming
See All in Programming
Azure AI Foundryのご紹介
qt_luigi
1
240
Compose でデザインと実装の差異を減らすための取り組み
oidy
1
210
DevinとCursorから学ぶAIエージェントメモリーの設計とMoatの考え方
itarutomy
1
430
AWS Lambda functions with C# 用の Dev Container Template を作ってみた件
mappie_kochi
0
200
Linux && Docker 研修/Linux && Docker training
forrep
14
2.7k
Immutable ActiveRecord
megane42
0
100
Lookerは可視化だけじゃない。UIコンポーネントもあるんだ!
ymd65536
1
130
chibiccをCILに移植した結果 (NGK2025S版)
kekyo
PRO
0
170
Swiftコンパイラ超入門+async関数の仕組み
shiz
0
190
自分ひとりから始められる生産性向上の取り組み #でぃーぷらすオオサカ
irof
8
2k
DMMオンラインサロンアプリのSwift化
hayatan
0
230
AWSマネコンに複数のアカウントで入れるようになりました
yuhta28
2
130
Featured
See All Featured
Practical Orchestrator
shlominoach
186
10k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Thoughts on Productivity
jonyablonski
68
4.4k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5.2k
Facilitating Awesome Meetings
lara
51
6.2k
What's in a price? How to price your products and services
michaelherold
244
12k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.8k
RailsConf 2023
tenderlove
29
980
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
3
260
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
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