Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -2,7 +2,7 @@ def merge_sort(m)
|
|||
return m if m.length <= 1
|
||||
|
||||
middle = m.length / 2
|
||||
left = m[0,middle]
|
||||
left = m[0..middle - 1]
|
||||
right = m[middle..-1]
|
||||
|
||||
left = merge_sort(left)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ class Array
|
|||
return self if length <= 1
|
||||
comparitor ||= lambda {|a, b| a <=> b}
|
||||
middle = length / 2
|
||||
left = self[0, middle].mergesort(&comparitor)
|
||||
left = self[0..middle - 1].mergesort(&comparitor)
|
||||
right = self[middle..-1].mergesort(&comparitor)
|
||||
merge(left, right, comparitor)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue