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
81
面試面試面試,因為很重要所以要說三次!
kuoe0
2
220
應徵軟體工程師
kuoe0
0
150
面試心得分享
kuoe0
0
400
Windows 真的不好用...
kuoe0
0
260
Python @Wheel Lab
kuoe0
0
190
Introduction to VP8
kuoe0
0
210
Python @NCKU_CSIE
kuoe0
0
100
[ACM-ICPC] Tree Isomorphism
kuoe0
1
230
Other Decks in Programming
See All in Programming
Package Traits
ikesyo
2
220
“あなた” の開発を支援する AI エージェント Bedrock Engineer / introducing-bedrock-engineer
gawa
9
1k
バックエンドのためのアプリ内課金入門 (サブスク編)
qnighy
1
160
ChatGPT とつくる PHP で OS 実装
memory1994
PRO
3
190
shadcn/uiを使ってReactでの開発を加速させよう!
lef237
0
350
Compose でデザインと実装の差異を減らすための取り組み
oidy
1
220
Scaling your build logic
antalmonori
1
130
AWS Lambda functions with C# 用の Dev Container Template を作ってみた件
mappie_kochi
0
200
Simple組み合わせ村から大都会Railsにやってきた俺は / Coming to Rails from the Simple
moznion
3
3.4k
最近のVS Codeで気になるニュース 2025/01
74th
1
220
混沌とした例外処理とエラー監視に秩序をもたらす
morihirok
18
3k
PHPとAPI Platformで作る本格的なWeb APIアプリケーション(入門編) / phpcon 2024 Intro to API Platform
ttskch
0
410
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
28
8.3k
The Language of Interfaces
destraynor
156
24k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
3
260
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
30
2.1k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
20
2.4k
Writing Fast Ruby
sferik
628
61k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
The Invisible Side of Design
smashingmag
299
50k
Building Better People: How to give real-time feedback that sticks.
wjessup
366
19k
Practical Orchestrator
shlominoach
186
10k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
980
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