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
merges sort
Search
Hiroki Kumamoto
July 21, 2015
0
82
merges sort
ミニ勉強会でmerge sortについて話したスライド
Hiroki Kumamoto
July 21, 2015
Tweet
Share
More Decks by Hiroki Kumamoto
See All by Hiroki Kumamoto
How to implement timetable view on iOS
kumabook
0
110
Promiseを実装してみよう
kumabook
0
340
bff_tips.pdf
kumabook
0
98
Tips of server-side rendering with react + redux
kumabook
0
91
プロトコルを使って複数サービスを跨いだmusic playerを実装する
kumabook
2
660
emacs helm likeな WebExtensions を作った話
kumabook
0
170
lightweight introducing with reactive cocoa
kumabook
0
66
basic_sort
kumabook
0
74
git_peco_tips
kumabook
0
35
Featured
See All Featured
The Pragmatic Product Professional
lauravandoore
37
7.2k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.1k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.5k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
1
1.4k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Leo the Paperboy
mayatellez
4
1.5k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
980
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
500
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
490
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.5k
AI: The stuff that nobody shows you
jnunemaker
PRO
3
480
Building Applications with DynamoDB
mza
96
7k
Transcript
Merge Sort Hiroki Kumamoto
Merge sort • ྻΛ̎ͭʹ͚Δ • ͦΕͧΕΛιʔτʢ࠶ؼతʣ • ̎ͭΛϚʔδ͢Δ • ιʔτࡁΈͷ̎ͭͷྻΛϚʔδͯ͠ιʔτ
ࡁΈͷͷΛ࡞Δͷ؆୯ʂ
Merge sort • NݸͷཁૉΛ࣋ͭྻΛιʔτ͢Δͱ͖ͷ • ൺֱͷճ C (N) • C(N)
<= C([N/2]) + C([N/2]) + N for N > 1 • C(1) = 0 • -> N log N • ྻͷΞΫηε • A(N) <= A([N/2]) + A([N/2]) + 6N for N > 1 • A(1) = 0 • -> 6 N log N • memory༻ྔ: N
Merge sort • Improvements • ༨ͳྻΛΘͣʹin-place Ϛʔδ • ࠷ॳinsertion sort
Λ͏ (7 ݸ·Ͱ) • ͢ͰʹιʔτࡁΈͳΒ్தͰεΩοϓ
• Visualize Demo • http://kumabook.github.io/playground/ index.html#merge-sort