2014年10月25日土曜日

開発環境

Practical Programming: An Introduction to Computer Science Using Python 3 (Pragmatic Programmers) (Paul Gries (著)、Jennifer Campbell (著)、Jason Montojo (著)、Lynn Beighley (編集)、Pragmatic Bookshelf)のChapter 13(Searching and Sorting)、13.7(Exercises), 4.を解いてみる。

13.7(Exercises), 4.

Selection sort

  1. [6, 5, 4, 3, 7, 1, 2]
  2. [1, 5, 4, 3, 7, 6, 2]
  3. [1, 2, 4, 3, 7, 6, 5]
  4. [1, 2, 3, 4, 7, 6, 5]
  5. [1, 2, 3, 4, 5, 6, 7]
  6. [1, 2, 3, 4, 5, 6, 7]

Insertion sort

  1. [6, 5, 4, 3, 7, 1, 2]
  2. [5, 6, 4, 3, 7, 1, 2]
  3. [4, 5, 6, 3, 7, 1, 2]
  4. [3, 4, 5, 6, 7, 1, 2]
  5. [3, 4, 5, 6, 7, 1, 2]
  6. [1, 3, 4, 5, 6, 7, 2]
  7. [1, 2, 3, 4, 5, 6, 7]

0 コメント:

コメントを投稿