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
86
0
Share
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
120
Promiseを実装してみよう
kumabook
0
350
bff_tips.pdf
kumabook
0
100
Tips of server-side rendering with react + redux
kumabook
0
92
プロトコルを使って複数サービスを跨いだmusic playerを実装する
kumabook
2
660
emacs helm likeな WebExtensions を作った話
kumabook
0
180
lightweight introducing with reactive cocoa
kumabook
0
68
basic_sort
kumabook
0
76
git_peco_tips
kumabook
0
37
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
528
40k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
64
53k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.5k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
150
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
130
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
320
Side Projects
sachag
455
43k
Building Adaptive Systems
keathley
44
3k
Designing Powerful Visuals for Engaging Learning
tmiket
1
340
Building Flexible Design Systems
yeseniaperezcruz
330
40k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.1k
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