Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
basic_sort
Search
Hiroki Kumamoto
June 23, 2015
87
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
140
Promiseを実装してみよう
kumabook
0
370
bff_tips.pdf
kumabook
0
110
Tips of server-side rendering with react + redux
kumabook
0
110
プロトコルを使って複数サービスを跨いだmusic playerを実装する
kumabook
2
700
emacs helm likeな WebExtensions を作った話
kumabook
0
180
merges sort
kumabook
0
93
lightweight introducing with reactive cocoa
kumabook
0
77
git_peco_tips
kumabook
0
46
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
331
22k
Why Our Code Smells
bkeepers
PRO
340
58k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.8k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
250
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
340
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
Tell your own story through comics
letsgokoyo
1
1.1k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Music & Morning Musume
bryan
48
7.4k
What does AI have to do with Human Rights?
axbom
PRO
1
2.4k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
440
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/