Title / Description
Code # æ’入排åºç®—法 def insert_sort(data) j = 1 while j < data.size key = data[j] i = j-1 while i >= 0 and data[i] > key data[i+1] = data[i] # å³ç§»æ•°æ® i -= 1 end data[i+1] = key j += 1 end data end puts insert_sort([33,5,53,2,56,7888])
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code