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
Insertion Sort
Search
KuoE0
March 03, 2013
Programming
0
1.5k
Insertion Sort
KuoE0
March 03, 2013
Tweet
Share
More Decks by KuoE0
See All by KuoE0
Protocol handler in Gecko
kuoe0
0
77
面試面試面試,因為很重要所以要說三次!
kuoe0
2
210
應徵軟體工程師
kuoe0
0
150
面試心得分享
kuoe0
0
390
Windows 真的不好用...
kuoe0
0
250
Python @Wheel Lab
kuoe0
0
180
Introduction to VP8
kuoe0
0
200
Python @NCKU_CSIE
kuoe0
0
95
[ACM-ICPC] Tree Isomorphism
kuoe0
1
220
Other Decks in Programming
See All in Programming
詳細解説! ArrayListの仕組みと実装
yujisoftware
0
580
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
330
Quine, Polyglot, 良いコード
qnighy
4
640
CSC509 Lecture 09
javiergs
PRO
0
140
Realtime API 入門
riofujimon
0
150
ペアーズにおけるAmazon Bedrockを⽤いた障害対応⽀援 ⽣成AIツールの導⼊事例 @ 20241115配信AWSウェビナー登壇
fukubaka0825
6
1.9k
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.1k
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
280
現場で役立つモデリング 超入門
masuda220
PRO
15
3.2k
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
110
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
Featured
See All Featured
Designing the Hi-DPI Web
ddemaree
280
34k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
Scaling GitHub
holman
458
140k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
A Tale of Four Properties
chriscoyier
156
23k
The Pragmatic Product Professional
lauravandoore
31
6.3k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
What's in a price? How to price your products and services
michaelherold
243
12k
Transcript
Insertion Sort ֲࢸݢʢKuoE0ʣ
[email protected]
KuoE0.ch
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) http://creativecommons.org/licenses/by-sa/3.0/ Latest update: Mar
3, 2013
4 1 2 1 8 9 3 The original sequence.
4 1 2 1 8 9 3
4 1 2 1 8 9 3 Set 1st element
as sorted part. 4
4 1 2 1 8 9 3 4
4 1 2 1 8 9 3 Others are unsorted
part. 4 1 2 1 8 9 3
4 1 2 1 8 9 3 4 1 2
1 8 9 3
4 1 2 1 8 9 3 Enumerate elements in
unsorted part. 4 1 2 1 8 9 3 1
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 Copy the value to temporal variable.
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 4
4 1 2 1 8 9 3 Find the foremost
element great than the current element. 4 temp: 1 2 1 8 9 3 1 1 4
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 4 1
4 1 2 1 8 9 3 Insert the element.
4 temp: 1 2 1 8 9 3 1 4 1
4 1 2 1 8 9 3 Insert the element.
4 1 2 1 8 9 3 1 1 4
4 1 2 1 8 9 3 Insert the element.
4 1 2 1 8 9 3 1 1 1 4
4 1 2 1 8 9 3 4 1 2
1 8 9 3 1 1 1 4
4 1 2 1 8 9 3 Enumerate next element.
4 1 2 1 8 9 3 1 1 1 4 2
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 2
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 2 Copy the value to temporal variable.
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 2 4
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 2 Find the foremost element great than the current element. 4
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 Insert the element. 2
4 1 2 1 8 9 3 4 1 2
1 8 9 3 1 1 1 4 2 4 Insert the element. 2
4 1 2 1 8 9 3 4 1 2
1 8 9 3 1 1 1 4 2 4 Insert the element. 2 2
4 1 2 1 8 9 3 4 1 2
1 8 9 3 1 1 1 4 2 4 2 2
4 1 2 1 8 9 3 4 1 2
1 8 9 3 1 1 1 4 2 4 2 2 Enumerate next element. 1
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 1
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 1 Copy the value to temporal variable.
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 1 4 2
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 1 Find the foremost element great than the current element. 4 2
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 1 Find the foremost element great than the current element. 4 2
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 Insert the element. 1
4 1 2 1 8 9 3 4 1 2
1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 Insert the element. 1
4 1 2 1 8 9 3 4 1 2
1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 Insert the element. 1 1
4 1 2 1 8 9 3 4 1 2
1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1
4 1 2 1 8 9 3 4 1 2
1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 Enumerate next element. 8
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 8
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 Copy the value to temporal variable. 8
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 8 4
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 8 No element is greater than the current element in sorted part. 4
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 8
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 Put back. 8
4 1 2 1 8 9 3 4 1 2
1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 Put back. 8
4 1 2 1 8 9 3 4 1 2
1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 Put back. 8 8
4 1 2 1 8 9 3 4 1 2
1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4
4 1 2 1 8 9 3 4 1 2
1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 Enumerate next element. 9
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 9 9
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 9 9 Copy the value to temporal variable.
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 9 9
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 9 9 No element is greater than the current element in sorted part.
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 9 9
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 9 Put back. 9
4 1 2 1 8 9 3 4 1 2
1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 9 Put back. 9
4 1 2 1 8 9 3 4 1 2
1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 9 Put back. 9 9
4 1 2 1 8 9 3 4 1 2
1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 9 9 9
4 1 2 1 8 9 3 4 1 2
1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 9 9 9 Enumerate next element. 3
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 9 9 9 3 3
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 9 9 9 3 Copy the value to temporal variable. 3
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 9 9 9 3 3 9 8 4
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 9 9 9 3 3 Find the foremost element great than the current element. 9 8 4
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 9 9 9 3 3 Find the foremost element great than the current element. 9 8 4
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 9 9 9 3 3 Find the foremost element great than the current element. 9 8 4
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 9 9 9 3 9 8 4 3
4 1 2 1 8 9 3 4 temp: 1
2 1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 9 9 9 3 9 8 4 Insert the element. 3
4 1 2 1 8 9 3 4 1 2
1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 9 9 9 3 9 8 4 Insert the element. 3
4 1 2 1 8 9 3 4 1 2
1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 9 9 9 3 9 8 4 Insert the element. 3 3
4 1 2 1 8 9 3 4 1 2
1 8 9 3 1 1 1 4 2 4 2 2 1 4 2 1 1 8 4 9 9 9 3 9 8 4 Sort completely! 3 3
End