update
This commit is contained in:
parent
1f1ad49427
commit
6f050a029e
2496 changed files with 37609 additions and 3031 deletions
|
|
@ -13,5 +13,5 @@ class Array
|
|||
end
|
||||
end
|
||||
ary = [7,6,5,9,8,4,3,1,2,0]
|
||||
ary.insertionsort!
|
||||
p ary.insertionsort!
|
||||
# => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
class Array
|
||||
def insertionsort!
|
||||
return if length < 2
|
||||
|
||||
1.upto(length - 1) do |i|
|
||||
value = delete_at i
|
||||
j = i - 1
|
||||
|
|
@ -13,5 +11,5 @@ class Array
|
|||
end
|
||||
|
||||
ary = [7,6,5,9,8,4,3,1,2,0]
|
||||
ary.insertionsort!
|
||||
p ary.insertionsort!
|
||||
# => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue