
{"id":6225,"date":"2011-11-15T19:11:23","date_gmt":"2011-11-15T19:11:23","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?p=6225"},"modified":"2011-11-15T19:11:23","modified_gmt":"2011-11-15T19:11:23","slug":"shellsort-using-php","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2011\/11\/15\/shellsort-using-php\/","title":{"rendered":"shellsort using php"},"content":{"rendered":"<pre>\n&lt;?\n\/\/ function shellsort($elements,$length)\n\/\/  {\n\n$elements = array(2,3,4,5,1,8,11,0);\n$length = count($elements);\n     $k=0;\n     $gap[0]=(int) ($length \/ 2);\n     while($gap[$k]&gt;1)\n     {\n         $k++;\n         $gap[$k]=(int)($gap[$k-1]\/2);\n     }\/\/end while\n\n     for($i=0;$i&lt;=$k;$i++)\n     {\n     $step=$gap[$i];\n         for($j=$step;$j=0 &amp;&amp; $temp&lt;$elements[$p])\n             {\n                 $elements[$p+$step]=$elements[$p];\n                 $p=$p-$step;\n             }\/\/end while\n             $elements[$p+$step]=$temp;\n         }\/\/endfor j\n     }\/\/endfor i\n\/\/     return $elements;\n\nprint_r($elements);\n\/\/  }\/\/ end function\n\n?&gt;\n<\/pre>\n<p>http:\/\/www.go4expert.com\/forums\/showthread.php?t=1255<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&lt;? \/\/ function shellsort($elements,$length) \/\/ { $elements = array(2,3,4,5,1,8,11,0); $length = count($elements); $k=0; $gap[0]=(int) ($length \/ 2); while($gap[$k]&gt;1) { $k++; $gap[$k]=(int)($gap[$k-1]\/2); }\/\/end while for($i=0;$i&lt;=$k;$i++) { $step=$gap[$i]; for($j=$step;$j=0 &amp;&amp; $temp&lt;$elements[$p]) { $elements[$p+$step]=$elements[$p]; $p=$p-$step; }\/\/end while $elements[$p+$step]=$temp; }\/\/endfor j }\/\/endfor i \/\/ return $elements; print_r($elements); \/\/ }\/\/ end function ?&gt; http:\/\/www.go4expert.com\/forums\/showthread.php?t=1255<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/6225"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=6225"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/6225\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=6225"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=6225"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=6225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}