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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Hiroki Kumamoto
July 21, 2015
92
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
merges sort
ミニ勉強会でmerge sortについて話したスライド
Hiroki Kumamoto
July 21, 2015
More Decks by Hiroki Kumamoto
See All by Hiroki Kumamoto
How to implement timetable view on iOS
kumabook
0
130
Promiseを実装してみよう
kumabook
0
360
bff_tips.pdf
kumabook
0
100
Tips of server-side rendering with react + redux
kumabook
0
100
プロトコルを使って複数サービスを跨いだmusic playerを実装する
kumabook
2
680
emacs helm likeな WebExtensions を作った話
kumabook
0
180
lightweight introducing with reactive cocoa
kumabook
0
73
basic_sort
kumabook
0
80
git_peco_tips
kumabook
0
41
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.6k
Making Projects Easy
brettharned
120
6.7k
Heart Work Chapter 1 - Part 1
lfama
PRO
8
36k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.7k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.3k
The browser strikes back
jonoalderson
0
1.5k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
160
GraphQLとの向き合い方2022年版
quramy
50
15k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6k
Producing Creativity
orderedlist
PRO
348
40k
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