{"id":4813,"date":"2014-12-06T10:00:04","date_gmt":"2014-12-06T01:00:04","guid":{"rendered":"http:\/\/www.techscore.com\/blog\/?p=4813"},"modified":"2018-11-14T16:33:50","modified_gmt":"2018-11-14T07:33:50","slug":"comparison-of-sorting-algorithm","status":"publish","type":"post","link":"https:\/\/www.techscore.com\/blog\/2014\/12\/06\/comparison-of-sorting-algorithm\/","title":{"rendered":"50\u4ee5\u4e0b\u633f\u5165\u30bd\u30fc\u30c8\u30015\u4e07\u4ee5\u4e0b\u30de\u30fc\u30b8\u30bd\u30fc\u30c8\u3001\u3042\u3068\u306f\u30af\u30a4\u30c3\u30af\u30bd\u30fc\u30c8"},"content":{"rendered":"
\u3053\u3093\u306b\u3061\u306f\u3001\u9234\u6728\u3067\u3059\u3002<\/p>\n
TECHSCORE Advent Calendar 2014<\/a> \u306e 6 \u65e5\u76ee\u306e\u6295\u7a3f\u3067\u3059\u3002<\/p>\n \u5bd2\u304f\u306a\u3063\u3066\u304d\u305f\u306e\u3067\u30bd\u30fc\u30c6\u30a3\u30f3\u30b0\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3092\u3044\u304f\u3064\u304b\u5b9f\u88c5\u3057\u3066\u3001\u901f\u5ea6\u3092\u6bd4\u8f03\u3057\u307e\u3057\u305f\u3002<\/p>\n \u6e2c\u5b9a\u7528\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u4ee5\u4e0b\u306e\u5834\u6240\u3067\u516c\u958b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n <\/p>\n \u307e\u305a\u306f\u6e2c\u5b9a\u7d50\u679c\u3067\u3059\u3002<\/p>\n \u30e9\u30f3\u30c0\u30e0\u306a\u6574\u6570\uff08int \u578b\uff09\u306e\u914d\u5217\u3092\u30bd\u30fc\u30c8\u3059\u308b C++ \u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u3044\u3066\u6bd4\u8f03\u3057\u307e\u3057\u305f\u3002<\/p>\n \u80cc\u666f\u304c\u9ec4\u8272\u306e\u30bb\u30eb\u306f\u305d\u306e\u6761\u4ef6\uff08\u30c7\u30fc\u30bf\u6570\uff09\u3067\u6700\u3082\u901f\u304b\u3063\u305f\u3082\u306e\u3001\u80cc\u666f\u304c\u30d4\u30f3\u30af\u306e\u30bb\u30eb\u306f 2 \u756a\u76ee\u306b\u901f\u304b\u3063\u305f\u3082\u306e\u3067\u3059\uff08\u6642\u9593\u304c\u304b\u304b\u308a\u3059\u304e\u3066\u6e2c\u5b9a\u3092\u6253\u3061\u5207\u3063\u305f\u3082\u306e\u306f\u30b0\u30ec\u30fc\u3067\u3059\uff09\u3002<\/p>\n \u30c7\u30fc\u30bf\u6570\u306f 2 \u306e\u3079\u304d\u4e57\u306b\u3057\u305f\u306e\u3067\u53b3\u5bc6\u306b\u901f\u5ea6\u304c\u9006\u8ee2\u3059\u308b\u30c7\u30fc\u30bf\u6570\u306f\u5206\u304b\u308a\u307e\u305b\u3093\u304c\u3001<\/p>\n \u3068\u3044\u3063\u305f\u3068\u3053\u308d\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n \u8ffd\u52a0\u306e\u30e1\u30e2\u30ea\u5272\u308a\u5f53\u3066\u304c\u5fc5\u8981\u306a\u30de\u30fc\u30b8\u30bd\u30fc\u30c8\u306f\u4f7f\u3044\u305f\u304f\u306a\u3044\uff01\u3000\u3068\u3044\u3046\u5834\u5408\u306f\u3001<\/p>\n \u304c\u76ee\u5b89\u306b\u306a\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n <\/p>\n \u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306e\u672c\u3092\u958b\u304f\u3068\u5927\u62b5\u300c\u30af\u30a4\u30c3\u30af\u30bd\u30fc\u30c8\u306a\u3069\u306e\u9ad8\u901f\u306a\u30bd\u30fc\u30c8\u306f\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9\u304c\u5927\u304d\u3044\u306e\u3067\u3001\u30c7\u30fc\u30bf\u6570\u304c\u5c11\u306a\u3044\u3068 O(N^2) \u306e\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3088\u308a\u9045\u3044\u300d\u3068\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n \u5b9f\u969b\u306b\u6bd4\u8f03\u3057\u3066\u307f\u308b\u3068\u78ba\u304b\u306b\u305d\u306e\u901a\u308a\u3067\u3001\u7279\u306b\u30de\u30fc\u30b8\u30bd\u30fc\u30c8\u306f\u9045\u3044\u3067\u3059\u306d\u3002\u3053\u308c\u306f\u30de\u30fc\u30b8\u30bd\u30fc\u30c8\u306f\u4ed6\u306e\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3068\u9055\u3063\u3066\u8ffd\u52a0\u306e\u30e1\u30e2\u30ea\u5272\u308a\u5f53\u3066\/\u89e3\u653e\u304c\u5fc5\u8981\u306a\u306e\u3067\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9\u304c\u3088\u308a\u5927\u304d\u3044\u3068\u3044\u3046\u3053\u3068\u3067\u3057\u3087\u3046\u3002<\/p>\n <\/p>\n \u300c\u30c7\u30fc\u30bf\u6570\u304c\u5927\u304d\u304f\u306a\u308b\u3068\u30af\u30a4\u30c3\u30af\u30bd\u30fc\u30c8\u304c\u6700\u901f\u300d\u3068\u8a00\u308f\u308c\u307e\u3059\u304c\u3001\u5177\u4f53\u7684\u306b\u30c7\u30fc\u30bf\u6570\u304c\u3069\u308c\u304f\u3089\u3044\u306b\u306a\u308b\u3068\u30af\u30a4\u30c3\u30af\u30bd\u30fc\u30c8\u304c\u9ad8\u901f\u3068\u3044\u3048\u308b\u306e\u304b\u3054\u5b58\u77e5\u3067\u3057\u305f\u304b\uff1f<\/p>\n \u4e0a\u8a18\u306e\u7d50\u679c\u3092\u898b\u308b\u3068\u30c7\u30fc\u30bf\u6570\u304c 32768 \u306e\u3068\u304d\u306b\u30de\u30fc\u30b8\u30bd\u30fc\u30c8\u3068\u307b\u307c\u4e92\u89d2\u3002\u300c\u3068\u308a\u3042\u3048\u305a\u30af\u30a4\u30c3\u30af\u30bd\u30fc\u30c8\u3092\u4f7f\u3063\u3066\u304a\u3051\u300d\u3067\u6b63\u89e3\u306e\u5834\u5408\u3082\u591a\u3044\u3067\u3059\u304c\u3001\u808c\u611f\u899a\u3068\u3057\u3066\u7406\u89e3\u3057\u3066\u3044\u308b\u3068\u4f55\u304b\u306e\u5f79\u306b\u7acb\u3064\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n <\/p>\n \u3068\u3053\u308d\u3067\u30b3\u30fc\u30e0\u30bd\u30fc\u30c8 (Comb Sort) \u3063\u3066\u3054\u5b58\u77e5\u3067\u3057\u3087\u3046\u304b\uff1f\u3000\u3082\u306e\u3059\u3054\u304f\u7c21\u5358\u306b\u8aac\u660e\u3059\u308b\u3068\u300c\u30c7\u30fc\u30bf\u3092\u4e00\u5b9a\u9593\u9694\u3067\u3056\u3063\u304f\u308a\u30d0\u30d6\u30eb\u30bd\u30fc\u30c8\u3059\u308b\u3001\u305d\u306e\u9593\u9694\u3092\u5f90\u3005\u306b\u5c0f\u3055\u304f\u3057\u3066\u3044\u304f\u300d\u3068\u3044\u3046\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3067\u3059\u3002<\/p>\n \u6559\u79d1\u66f8\u306e\u4e2d\u3067\u3057\u304b\u751f\u304d\u3089\u308c\u306a\u3044\u3093\u3058\u3083\u306a\u3044\u304b\u3068\u601d\u3046\u307b\u3069\u306b\u9045\u3044\u30d0\u30d6\u30eb\u30bd\u30fc\u30c8\u3092\u6539\u826f\u3057\u305f\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u304c\u30b3\u30fc\u30e0\u30bd\u30fc\u30c8\u306a\u306e\u3067\u3059\u304c\u3001\u3053\u308c\u304c\u610f\u5916\u3068\u901f\u3044\u3068\u306f\u9a5a\u304d\u3067\u3059\u306d\u3002<\/p>\n <\/p>\n \u4eca\u56de\u306f\u30d9\u30fc\u30b7\u30c3\u30af\u306a\u30bd\u30fc\u30c6\u30a3\u30f3\u30b0\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306e\u901f\u5ea6\u3092\u6bd4\u8f03\u3057\u307e\u3057\u305f\u3002\u30bd\u30fc\u30c6\u30a3\u30f3\u30b0\u306f\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306e\u4e2d\u3067\u3082\u6614\u304b\u3089\u3042\u308b\u5206\u91ce\u3067\u3001\u901a\u5e38\u306f\u8a00\u8a9e\u3084\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u63d0\u4f9b\u3057\u3066\u304f\u308c\u308b\u306e\u3067\u81ea\u5206\u3067\u5b9f\u88c5\u3059\u308b\u3053\u3068\u306f\u5c11\u306a\u3044\u3067\u3059\u304c\u3001\u6539\u3081\u3066\u5b9f\u88c5\u3057\u3066\u6bd4\u8f03\u3057\u3066\u307f\u308b\u3068\u9762\u767d\u3044\u3067\u3059\u306d\u3002<\/p>\n \u30bd\u30fc\u30c6\u30a3\u30f3\u30b0\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306f\u6570\u591a\u304f\u3042\u308b\u306e\u3067\u3001\u8208\u5473\u3092\u6301\u3063\u305f\u65b9\u306f\u8abf\u3079\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002\u5b9f\u8df5\u7684\u306a\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3067\u306f introsort \u3084 tim sort \u306a\u3069\u304c\u3042\u308a\u307e\u3059\u3002\u6bd4\u8f03\u3092\u3057\u306a\u3044 bin sort, bucket sort, distribution counting sort, inverse mapping sort \u306a\u3069\u3082\u9762\u767d\u3044\u306e\u3067\u305c\u3072\u8abf\u3079\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n \u30bd\u30fc\u30c6\u30a3\u30f3\u30b0\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306b\u8208\u5473\u3092\u6301\u3063\u305f\u65b9\u304c\u4e00\u4eba\u3067\u3082\u5897\u3048\u305f\u3089\u5b09\u3057\u3044\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":" \u3053\u3093\u306b\u3061\u306f\u3001\u9234\u6728\u3067\u3059\u3002<\/p>\n TECHSCORE Advent Calendar 2014 \u306e 6 \u65e5\u76ee\u306e\u6295\u7a3f\u3067\u3059\u3002<\/p>\n \u5bd2\u304f\u306a\u3063\u3066\u304d\u305f\u306e\u3067\u30bd\u30fc\u30c6\u30a3\u30f3\u30b0\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3092\u3044\u304f\u3064\u304b\u5b9f\u88c5\u3057\u3066\u3001\u901f\u5ea6\u3092\u6bd4\u8f03\u3057\u307e\u3057\u305f\u3002\n
\u6e2c\u5b9a\u7d50\u679c<\/h2>\n
<\/a><\/p>\n
\n
\n
\u9ad8\u901f\u306a\u30bd\u30fc\u30c8\u306f\u30c7\u30fc\u30bf\u6570\u304c\u5c11\u306a\u3044\u3068\u9045\u3044<\/h2>\n
\u30af\u30a4\u30c3\u30af\u30bd\u30fc\u30c8\u304c\u9ad8\u901f\u306a\u306e\u306f\u30c7\u30fc\u30bf\u6570\u304c\u975e\u5e38\u306b\u5927\u304d\u304f\u306a\u3063\u3066\u304b\u3089<\/h2>\n
\u30b3\u30fc\u30e0\u30bd\u30fc\u30c8\u304c\u610f\u5916\u3068\u304c\u3093\u3070\u308b<\/h2>\n
\u307e\u3068\u3081<\/h2>\n
\u7d9a\u304d\u3092\u8aad\u3080...<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[18],"tags":[141,142],"_links":{"self":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/4813"}],"collection":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/comments?post=4813"}],"version-history":[{"count":16,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/4813\/revisions"}],"predecessor-version":[{"id":4831,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/4813\/revisions\/4831"}],"wp:attachment":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/media?parent=4813"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/categories?post=4813"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/tags?post=4813"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}