insertion sortã¯ãæ¿å ¥ã½ã¼ããã¨è¨³ãããã(Wikipediaâ http://ja.wikipedia.org/wiki/%E6%8C%BF%E5%85%A5%E3%82%BD%E3%83%BC%E3%83%88 ) â ãæ¥æ¬èªç Wikipediaã®æ¥æ¬èªã®ãã¼ã¸ã®ã³ã¼ããå¼ç¨ããã¨æ¬¡ã®ããã«ãªã£ã¦ããã for (i = 1; i < n; i++) { tmp = data[i]; for (j = i; j > 0 && data[j-1] > tmp; j--) { data[j] = data[j-1]; } data[j] = tmp; }ä¸ã®ã³ã¼ãã§ã¯ãå å´ã®ã«ã¼ãã§insertã®å¿ è¦ããªãã£ãå ´åã§ãæå¾ã«data[j] = tmpã§tmpå¤æ°ãwrite backãã¦ãããããããinsertã®å¿ è¦ã®ãªãã£ãå ´åã§ãj=iã1åå®è¡ãããããããã®æå³ã«
{{#tags}}- {{label}}
{{/tags}}