{"id":45534,"date":"2023-12-11T15:06:06","date_gmt":"2023-12-11T07:06:06","guid":{"rendered":"https:\/\/wx.kaifamiao.info\/?p=45534"},"modified":"2023-12-11T15:06:06","modified_gmt":"2023-12-11T07:06:06","slug":"java%e7%89%88%e6%8f%92%e5%85%a5%e6%8e%92%e5%ba%8f%e7%a8%b3%e5%ae%9a-2","status":"publish","type":"post","link":"http:\/\/wx.kaifamiao.info\/index.php\/2023\/12\/11\/java%e7%89%88%e6%8f%92%e5%85%a5%e6%8e%92%e5%ba%8f%e7%a8%b3%e5%ae%9a-2\/","title":{"rendered":"Java\u7248\u63d2\u5165\u6392\u5e8f[\u7a33\u5b9a]"},"content":{"rendered":"<p>&#8220;`&#8221;                    \u9002\u7528\u4e8e\u5c0f\u6570\u7ec4,\u6570\u7ec4\u5df2\u6392\u597d\u5e8f\u6216\u63a5\u8fd1\u4e8e\u6392\u597d\u5e8f\u901f\u5ea6\u5c06\u4f1a\u975e\u5e38\u5feb<\/p>\n<p>\u590d\u6742\u5ea6\uff1aO(n^2) &#8211; O(n) &#8211; O(n^2) &#8211; O(1)[\u5e73\u5747 &#8211; \u6700\u597d &#8211; \u6700\u574f &#8211; \u7a7a\u95f4\u590d\u6742\u5ea6]<\/p>\n<p>&lt;pre&gt;&lt;code class=&quot;&quot;language-java&quot;&quot; lang=&quot;&quot;java&quot;&quot;&gt;public void insertionSort(int[] a) {<br \/>\n        if (null == a || a.length &lt; 2) {<br \/>\n            return;<br \/>\n        }<br \/>\n        for (int i = 1; i &lt; a.length; i++) {<br \/>\n            \/\/ \u6682\u5b58\u5f53\u524d\u503c<br \/>\n            int temp = a[i];<br \/>\n            int j = i &#8211; 1;<br \/>\n            while (j &gt;= 0 &amp;&amp; temp &lt; a[j]) {<br \/>\n                \/\/ \u540e\u79fb<br \/>\n                a[j + 1] = a[j];<br \/>\n                j&#8211;;<br \/>\n            }<br \/>\n            \/\/ \u5f53\u524d\u503c\u5f52\u4f4d<br \/>\n            a[j + 1] = temp;<br \/>\n        }<br \/>\n    }<br \/>\n&lt;\/code&gt;&lt;\/pre&gt;<\/p>\n<p>&lt;pre&gt;&lt;code&gt;            &quot;&#8220;`<br \/>\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;`&#8221; \u9002\u7528\u4e8e\u5c0f\u6570\u7ec4,\u6570\u7ec4\u5df2\u6392\u597d\u5e8f\u6216\u63a5\u8fd1\u4e8e\u6392\u597d\u5e8f\u901f\u5ea6\u5c06\u4f1a\u975e\u5e38\u5feb \u590d\u6742\u5ea6\uff1aO(n^2)  [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-45534","post","type-post","status-publish","format-standard","hentry","category-c"],"_links":{"self":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/45534","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/comments?post=45534"}],"version-history":[{"count":1,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/45534\/revisions"}],"predecessor-version":[{"id":45535,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/45534\/revisions\/45535"}],"wp:attachment":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/media?parent=45534"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/categories?post=45534"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/tags?post=45534"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}