{"id":419,"date":"2013-03-07T17:52:00","date_gmt":"2013-03-07T08:52:00","guid":{"rendered":""},"modified":"2021-06-05T11:56:17","modified_gmt":"2021-06-05T02:56:17","slug":"selection-sortpython","status":"publish","type":"post","link":"https:\/\/www.sigmadesign.co.jp\/minomonchan\/2013\/03\/selection-sortpython.html","title":{"rendered":"\u300c\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3092\u3001\u306f\u3058\u3081\u3088\u3046\u300d\u5358\u7d14\u9078\u629e\u6cd5\uff08\u9078\u629e\u30bd\u30fc\u30c8, selection sort\uff09\u3092Python\u3067\u66f8\u304f"},"content":{"rendered":"<p><a href=\"https:\/\/www.sigmadesign.co.jp\/minomonchan\/2013\/03\/python_2238.html\">\u524d\u56de\u306e\u30cf\u30c3\u30b7\u30e5\u63a2\u7d22\u6cd5<\/a>\u307e\u3067\u304c\u63a2\u7d22\u306e\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3067\u3001\u4eca\u56de\u304b\u3089\u306f\u30bd\u30fc\u30c8\u306e\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306b\u7a81\u5165\u3067\u3059\u3002<\/p>\n<p>12,13,11,14,10\u3068\u4e26\u3093\u3067\u3044\u308b\u6570\u5b57\u3092\u9078\u629e\u30bd\u30fc\u30c8(selection sort)\u3092\u4f7f\u3063\u3066\u6607\u9806\u306b\u4e26\u3079\u66ff\u3048\u308b\u554f\u984c\u3002<\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-653\" src=\"http:\/\/www.sigmadesign.co.jp\/minomonchan\/wp-content\/uploads\/sites\/2\/2013\/03\/41Ugo9OyzSL_SY291_BO1204203200_QL40_ML2_.jpg\" alt=\"\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3092\u3001\u306f\u3058\u3081\u3088\u3046\" width=\"207\" height=\"293\" \/><\/p>\n<p><a href=\"http:\/\/www.amazon.co.jp\/exec\/obidos\/ASIN\/4844332015\/shikakukingu-22\" target=\"_blank\" rel=\"nofollow noopener\">\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3092\u3001\u306f\u3058\u3081\u3088\u3046<\/a><\/p>\n<p>\u7b2c\uff17\u7ae0\uff1a\u5358\u7d14\u9078\u629e\u6cd5\uff08\u9078\u629e\u30bd\u30fc\u30c8, selection sort\uff09\u306e\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0<\/p>\n<div style=\"background-color: lightgray; padding: 10px;\">\n<pre><code>\r\n#!\/usr\/bin\/env python\r\n#-*- coding: utf-8 -*-\r\n\r\ndef main():\r\n    array = [12, 13, 11, 14, 10]\r\n    for i in xrange(len(array)):\r\n        min = i\r\n        for j in xrange(i+1, len(array)):\r\n            if array[j] &lt; array[min]:\r\n                min = j\r\n        array[i], array[min] = array[min], array[i]\r\n    print array\r\n\r\nif __name__ == '__main__':\r\n    main()\r\n<\/code><\/pre>\n<\/div>\n<p>\u305f\u3076\u3093\u3053\u308c\u3067\u5408\u3063\u3066\u3044\u308b\u3068\u601d\u3063\u305f\u3051\u3069\u3001\u3053\u308c\u66f8\u304f\u306e\u306b\uff13\u6642\u9593\u304f\u3089\u3044\u304b\u304b\u3063\u305f\u3002\u3044\u308d\u3093\u306a\u4eba\u304c\u66f8\u3044\u3066\u3044\u308b\u30b3\u30fc\u30c9\u3092\u898b\u305b\u3066\u3082\u3089\u3063\u3066\u4f55\u3068\u304b\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u304d\u3066\u3057\u307e\u3048\u3070\u3001\u4f55\u3082\u96e3\u3057\u3044\u4e8b\u306f\u306a\u3044\u3093\u3060\u3051\u3069\u3001\u6700\u521d\u81ea\u5206\u3067\u8003\u3048\u3066\u3044\u305f\u6642\u306f\u3001\u6df7\u4e71\u3057\u307e\u304f\u308a\u3067\u4e45\u3057\u3076\u308a\u306b\u77e5\u6075\u71b1\u304c\u51fa\u307e\u3057\u305f\u3088\u3002<\/p>\n<p>\uff12\u6bb5\u968e\u76ee\u306efor\u30eb\u30fc\u30d7\u306e\u90e8\u5206\u3092while\u3067\u66f8\u3044\u3066\u305f\u308a\u3002<\/p>\n<p>\u5909\u6570j\u304ci+1\u306a\u3093\u3060\u3063\u3066\u4e8b\u306b\u6c17\u3065\u3051\u3070\u304b\u306a\u308a\u697d\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u3046\u3044\u3046\u57fa\u672c\u7684\u306a\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3092\u4f55\u5ea6\u3082\u4f55\u5ea6\u3082\u66f8\u304d\u76f4\u3057\u3066\u3001\u4f55\u3082\u8003\u3048\u305a\u306b\u624b\u304c\u52d5\u304f\u3088\u3046\u306b\u306a\u308b\u307e\u3067\u3084\u308a\u307e\u3059\u3002\u6700\u4f4e\u3067\u3082\uff11\uff10\u56de\u304f\u3089\u3044\u306f\u5fc5\u8981\u304b\u306a\u3002<\/p>\n<p>\u305d\u308c\u304c\u3067\u304d\u3066\u304b\u3089\u6b21\u306e\u30b9\u30c6\u30c3\u30d7\u306e\u672c\u306b\u9032\u307f\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u306e\u30cf\u30c3\u30b7\u30e5\u63a2\u7d22\u6cd5\u307e\u3067\u304c\u63a2\u7d22\u306e\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3067\u3001\u4eca\u56de\u304b\u3089\u306f\u30bd\u30fc\u30c8\u306e\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306b\u7a81\u5165\u3067\u3059\u3002 12,13,11,14,10 &#8230; <\/p>\n","protected":false},"author":1,"featured_media":653,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[75],"tags":[33],"class_list":["post-419","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology","tag-python"],"_links":{"self":[{"href":"https:\/\/www.sigmadesign.co.jp\/minomonchan\/wp-json\/wp\/v2\/posts\/419","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sigmadesign.co.jp\/minomonchan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sigmadesign.co.jp\/minomonchan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sigmadesign.co.jp\/minomonchan\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sigmadesign.co.jp\/minomonchan\/wp-json\/wp\/v2\/comments?post=419"}],"version-history":[{"count":0,"href":"https:\/\/www.sigmadesign.co.jp\/minomonchan\/wp-json\/wp\/v2\/posts\/419\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sigmadesign.co.jp\/minomonchan\/wp-json\/wp\/v2\/media\/653"}],"wp:attachment":[{"href":"https:\/\/www.sigmadesign.co.jp\/minomonchan\/wp-json\/wp\/v2\/media?parent=419"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sigmadesign.co.jp\/minomonchan\/wp-json\/wp\/v2\/categories?post=419"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sigmadesign.co.jp\/minomonchan\/wp-json\/wp\/v2\/tags?post=419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}