Ruby:简单的插入排序 2015/03/17 14475 #Insertion Sort Method def insertionSort(list) list.each_with_index do |data,i| j = i - 1 while j >= 0 break if list[j] <= data list[j + 1] = list[j] j = j - 1 end list[j + 1] = data end end