{"id":252,"date":"2011-11-08T00:47:33","date_gmt":"2011-11-07T16:47:33","guid":{"rendered":"http:\/\/wangkaixuan.tech\/?p=252"},"modified":"2020-06-06T00:48:34","modified_gmt":"2020-06-05T16:48:34","slug":"%e6%95%b0%e6%8d%ae%e7%bb%93%e6%9e%84_%e5%86%85%e9%83%a8%e6%8e%92%e5%ba%8f_%e6%8f%92%e5%85%a5%e6%8e%92%e5%ba%8f%e5%b0%8f%e7%bb%83%e4%b9%a0","status":"publish","type":"post","link":"http:\/\/www.wangkaixuan.tech\/?p=252","title":{"rendered":"\u6570\u636e\u7ed3\u6784_\u5185\u90e8\u6392\u5e8f_\u63d2\u5165\u6392\u5e8f\u5c0f\u7ec3\u4e60"},"content":{"rendered":"\n<p>\u91c7\u7528\u4e86\u4e24\u79cd\u4e0d\u540c\u7684\u6392\u5e8f\u65b9\u6cd5\uff0c\u5404\u6709\u4f18\u52a3\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;iostream>\n#include&lt;ctime>\nusing namespace std;\n#define ListLen 10\n#define radombase 100\nvoid print(int a&#91;])\n{\n\tfor(int i=0;i&lt;ListLen;i++)\n\t\tcout&lt;&lt;a&#91;i]&lt;&lt;\" \";\n\tcout&lt;&lt;endl;\t\n}\/*\nvoid InsertSort(int a&#91;])\n{\n\tint temp;\n\tfor(int i=1;i&lt;ListLen;i++)\n\t{\n\t\t\tint j=0;\n\t\t\twhile(j&lt;i&amp;&amp;a&#91;j]&lt;a&#91;i])\n\t\t\t\tj++;\n\t\t\tif(j&lt;i)\n\t\t\t{\n\t\t\t\ttemp=a&#91;i];\n\t\t\t\tfor(int k=i-1;k>=j;k--)\n\t\t\t\t\ta&#91;k+1]=a&#91;k];\n\t\t\t\ta&#91;j]=temp;\t\t\n\t\t\t}\n\t}\n}*\/\nvoid InsertSort(int a&#91;])\n{\n\tint temp,j;\n\tfor(int i=1;i&lt;ListLen;i++)\n\t{\n\t\t\tif(a&#91;i]&lt;a&#91;i-1])\n\t\t\t{\n\t\t\t\ttemp=a&#91;i];\n\t\t\t\tj=i-1;\n\t\t\t\twhile(j>=0&amp;&amp;temp&lt;a&#91;j])\n\t\t\t\t{\n\t\t\t\t\ta&#91;j+1]=a&#91;j];\n\t\t\t\t\ta&#91;j]=temp;\n\t\t\t\t\tj--;\t\n\t\t\t\t}\t\n\t\t\t}\n\t}\n}\nvoid GetRandomNum(int a&#91;])\n{\n\t\tsrand((unsigned)time(NULL));\n\t\tfor(int i=0;i&lt;ListLen;i++)\n\t\t\ta&#91;i]=rand()%radombase+1;\n}\nint main()\n{\n\tint a&#91;ListLen];\n\tGetRandomNum(a);\n\tprint(a);\n\tInsertSort(a);\n\tprint(a);\n\tsystem(\"pause\");\n    return 0;\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u91c7\u7528\u4e86\u4e24\u79cd\u4e0d\u540c\u7684\u6392\u5e8f\u65b9\u6cd5\uff0c\u5404\u6709\u4f18\u52a3\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-252","post","type-post","status-publish","format-standard","hentry","category-06-02-"],"_links":{"self":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts\/252","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=252"}],"version-history":[{"count":0,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts\/252\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=252"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=252"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=252"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}