{"id":755,"date":"2011-04-22T21:53:55","date_gmt":"2011-04-22T13:53:55","guid":{"rendered":"http:\/\/www.kumouse.com\/?p=755"},"modified":"2011-04-22T21:53:55","modified_gmt":"2011-04-22T13:53:55","slug":"bubble-%e5%86%92%e6%b3%a1%e6%8e%92%e5%ba%8f","status":"publish","type":"post","link":"https:\/\/www.kumouse.com\/?p=755","title":{"rendered":"bubble &#8211; \u5192\u6ce1\u6392\u5e8f"},"content":{"rendered":"<p>#include &lt;stdio.h&gt;<\/p>\n<p>\n\tint bubble(int *a,int len)<br \/>\n\t{<br \/>\n\t&nbsp;&nbsp;&nbsp; int i,j;<\/p>\n<p>\t&nbsp;&nbsp;&nbsp; for(i=0;i&lt;len-1;i++){<br \/>\n\t&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for(j=0;j&lt;len-i-1;j++){<br \/>\n\t&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(a[j]&gt;a[j+1]){<br \/>\n\t&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; a[j]^=a[j+1];<br \/>\n\t&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; a[j+1]^=a[j];<br \/>\n\t&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; a[j]^=a[j+1];<br \/>\n\t&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br \/>\n\t&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br \/>\n\t&nbsp;&nbsp;&nbsp; }<br \/>\n\t&nbsp;&nbsp;&nbsp; return 0;<br \/>\n\t}<\/p>\n<p>\tint main(void)<br \/>\n\t{<br \/>\n\t&nbsp;&nbsp;&nbsp; int a[]={6,5,4,3,2,1},i;<\/p>\n<p>\t&nbsp;&nbsp;&nbsp; bubble(a,6);<br \/>\n\t&nbsp;&nbsp;&nbsp; for(i=0;i&lt;6;i++){<br \/>\n\t&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; printf(&quot;%d &quot;,a[i]);<\/p>\n<p>\t&nbsp;&nbsp;&nbsp; }<br \/>\n\t&nbsp;&nbsp;&nbsp; printf(&quot;n&quot;);<br \/>\n\t&nbsp;&nbsp;&nbsp; <br \/>\n\t&nbsp;&nbsp;&nbsp; return 0;<br \/>\n\t}<\/p>\n<p>\t&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>#include &lt;stdio.h&gt; int bubble(int *a,int len) { &#038; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-755","post","type-post","status-publish","format-standard","hentry","category-linux-c"],"_links":{"self":[{"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/posts\/755","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=755"}],"version-history":[{"count":0,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/posts\/755\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.kumouse.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=755"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=755"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=755"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}