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
basic_sort
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Hiroki Kumamoto
June 23, 2015
79
0
Share
basic_sort
ミニ勉強会でアルゴリズムについて話したスライド
Hiroki Kumamoto
June 23, 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
97
プロトコルを使って複数サービスを跨いだmusic playerを実装する
kumabook
2
670
emacs helm likeな WebExtensions を作った話
kumabook
0
180
merges sort
kumabook
0
89
lightweight introducing with reactive cocoa
kumabook
0
68
git_peco_tips
kumabook
0
39
Featured
See All Featured
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.9k
Six Lessons from altMBA
skipperchong
29
4.3k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
Facilitating Awesome Meetings
lara
57
6.9k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.6k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
410
RailsConf 2023
tenderlove
30
1.5k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
54k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
160
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
350
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
Transcript
Basic Sort Hiroki Kumamoto
Selection Sort • Ұ൪খ͍͞Λ୳͢ͱ͍͏ͷΛNճ܁Γฦ͢ • Ұ൪খ͍͞ͷΛa[i]ʹ࣋ͬͯ͘Δ • 1/2N^2 ͷൺֱ •
(N-1) + (N-2)+ …. + 1 + 0 • Nճͷަ • O(N^2)
• Visualize demo • http://kumabook.github.io/playground/ index.html#selection-sort
Insertion sort • i-1൪·Ͱ͕ྻ͍ͯ͠Δͱͯ͠ɺi൪ͷཁૉ Λ0..i൪ͷதͰਖ਼͍͠Ґஔʹૠೖ͢Δ • best case: ྻࡁΈ: N
-1 ͷൺֱ + 0ަ • worst case: ٯॱ: 1/2 N^2ͷൺֱ+ 1/2N^2ͷަ • O(N) ~ O(N^2)
• Visualize demo • http://kumabook.github.io/playground/ index.html#insertion-sort
Shell Sort • Insertion sort ٯॱʹฒΜͰ͍Δͱ͖ʹ͍ • → ͱͼͱͼͷinsertion sortԿճ͔ʹ͚ͯΔ
• Best sequence of increments? • 1, 3, 7, 15, 31, 63 … Powers of two minus one. • 1, 4, 13, 40, 121, 364…3x + 1 • ฏۉɿO (N ^ 3/2)
Shell Sort • αΠζͷখ͍͞ྻʹରͯ͠༗ޮ • bzip2, /linux/kernel/groups.c • ίʔυͷfoot print
͕খ͍͞ • uClibc
• Visualize demo • http://kumabook.github.io/playground/ index.html#shell-sort
Reference • Coursera: Algorithms, Part 1 • https://www.coursera.org/course/algs4partI • http://algs4.cs.princeton.edu/home/