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
85
面試面試面試,因為很重要所以要說三次!
kuoe0
2
230
應徵軟體工程師
kuoe0
0
150
面試心得分享
kuoe0
0
400
Windows 真的不好用...
kuoe0
0
270
Python @Wheel Lab
kuoe0
0
190
Introduction to VP8
kuoe0
0
220
Python @NCKU_CSIE
kuoe0
0
110
[ACM-ICPC] Tree Isomorphism
kuoe0
1
230
Other Decks in Programming
See All in Programming
Introduction to C Extensions
sylph01
3
130
複数のAWSアカウントから横断で 利用する Lambda Authorizer の作り方
tc3jp
0
130
推しメソッドsource_locationのしくみを探る - はじめてRubyのコードを読んでみた
nobu09
2
370
はじめての Go * WASM * OCR
sgash708
1
130
読まないコードリーディング術
hisaju
1
140
コミュニティ駆動 AWS CDK ライブラリ「Open Constructs Library」 / community-cdk-library
gotok365
2
260
Learning Kotlin with detekt
inouehi
1
220
Ça bouge du côté des animations CSS !
goetter
2
170
React 19アップデートのために必要なこと
uhyo
8
1.6k
CIBMTR振り返り+敗北から学ぶコンペの取り組み方反省
takanao
1
230
良いコードレビューとは
danimal141
10
9.2k
1年目の私に伝えたい!テストコードを怖がらなくなるためのヒント/Tips for not being afraid of test code
push_gawa
1
670
Featured
See All Featured
Done Done
chrislema
182
16k
Typedesign – Prime Four
hannesfritz
41
2.5k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Into the Great Unknown - MozCon
thekraken
35
1.7k
Writing Fast Ruby
sferik
628
61k
Why You Should Never Use an ORM
jnunemaker
PRO
55
9.2k
BBQ
matthewcrist
87
9.5k
A Philosophy of Restraint
colly
203
16k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.2k
For a Future-Friendly Web
brad_frost
176
9.6k
Thoughts on Productivity
jonyablonski
69
4.5k
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