title: implement shell sort by ruby
body: <p>I try to implement shell sort by ruby.</p>
  
  <pre><code>def shell_sort(list)
    d = list.length
    return -1 if d == 0
    (0...list.length).each do |i|
      d = d / 2
      puts "d:#{d}"
      (0...(list.length-d)).each do |j|
        if list[j] &gt;= list[j+d]
           list[j], list[j+d] = list[j+d], list[j]
        end
      end
      puts list.inspect
      break if d == 1
    end
    list
  end
  
  puts shell_sort([10,9,8,7,6,5,4,3,2,1]).inspect
  </code></pre>
  
  <p>but the result is incorrect.</p>
  
  <pre><code>=&gt;[2, 1, 3, 4, 5, 7, 6, 8, 9, 10]
  </code></pre>
  
  <p>I don't know where going wrong, hope someone can help me. Thanks in advance!</p>