{"id":225827,"date":"2014-06-10T12:40:03","date_gmt":"2014-06-10T08:40:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=225827"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=225827","title":{"rendered":"<span class=\"post_title\">\u0423\u0447\u0438\u043c\u0441\u044f \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/span>"},"content":{"rendered":"<div class=\"content html_format\">\n<h4>\u041a\u043b\u0430\u0441\u0441\u0438\u043a\u0430<\/h4>\n<p>  \u0421\u0430\u043c\u044b\u0439 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043a\u043e\u0434.<br \/>  <img decoding=\"async\" align=\"right\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/2e6\/1a5\/2f2\/2e61a52f20aa53a7ebf1b6a7dc905dca.png\"\/>  <\/p>\n<pre><code class=\"php\">    $size = sizeof($arr)-1;     for ($i = $size; $i&gt;=0; $i--) {         for ($j = 0; $j&lt;=($i-1); $j++)             if ($arr[$j]&gt;$arr[$j+1]) {                 $k = $arr[$j];                 $arr[$j] = $arr[$j+1];                 $arr[$j+1] = $k;             }     } <\/code><\/pre>\n<h4>\u0411\u0430\u0440\u043e\u043a\u043a\u043e<\/h4>\n<p>  \u0411\u0430\u0440\u043e\u043a\u043a\u043e (\u0438\u0442\u0430\u043b. barocco \u2014 \u00ab\u043f\u0440\u0438\u0447\u0443\u0434\u043b\u0438\u0432\u044b\u0439\u00bb, \u00ab\u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439\u00bb, \u00ab\u0441\u043a\u043b\u043e\u043d\u043d\u044b\u0439 \u043a \u0438\u0437\u043b\u0438\u0448\u0435\u0441\u0442\u0432\u0430\u043c\u00bb)<br \/>  \u0411\u0430\u0440\u043e\u043a\u043a\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435\u043d\u043d\u044b \u043a\u043e\u043d\u0442\u0440\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u044c, \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c, \u0441\u0442\u0440\u0435\u043c\u043b\u0435\u043d\u0438\u0435 \u043a \u0432\u0435\u043b\u0438\u0447\u0438\u044e \u0438 \u043f\u044b\u0448\u043d\u043e\u0441\u0442\u0438 \u043a\u0430\u043a \u0432 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0438, \u0442\u0430\u043a \u0438 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u043a \u0441\u043b\u0438\u044f\u043d\u0438\u044e \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0442\u0438\u043b\u0435\u0439 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041e\u0431\u044b\u0447\u043d\u043e \u0443\u0436\u0435 \u043d\u0430 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u043a\u0440\u044b\u0442\u044b\u0435 \u00ab\u0434\u0435\u0442\u043e\u043d\u0430\u0442\u043e\u0440\u044b\u00bb.<\/p>\n<p>  \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432: JavaScript, C++, Java.<\/p>\n<pre><code class=\"php\">    $SIZE = SIZEof($A_R__R)-1;     for ($i = $SIZE; $i&gt;=0; $i--) {         for ($j = 0; $j&lt;=($i-1); $j++)             if ($A_R__R[$j]&gt;$A_R__R[$j+1]) {                 \/\/\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0445\u0438\u0442\u0440\u044b\u0439 \u043c\u0430\u043d\u0451\u0432\u0440                 $A_R__R[$j+1]  = $A_R__R[$j];  + $A_R__R[$j+1];                 $A_R__R[$j]    = $A_R__R[$j+1] - $A_R__R[$j];                 $A_R__R[$j+1]  = $A_R__R[$j+1] - $A_R__R[$j];              }     } <\/code><\/pre>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0413\u043e\u0442\u0438\u043a\u0430<\/h4>\n<p>  \u0427\u0435\u0440\u0442\u044b \u0433\u043e\u0442\u0438\u043a\u0438:<br \/>  \u0414\u043b\u044f \u0433\u043e\u0442\u0438\u043a\u0438 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0432 \u0432\u0438\u0434\u0435 \u0432\u0441\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0433\u043e \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u044f, \u0431\u043e\u0433\u0430\u0442\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441 \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u043c\u0438 \u0434\u0435\u0442\u0430\u043b\u044f\u043c\u0438. \u0422\u0430\u043a \u0436\u0435 \u0447\u0430\u0441\u0442\u043e \u043a\u043e\u0434 \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043a \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0447\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u043d\u0443\u0448\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438 \u043c\u043e\u043d\u043e\u043b\u0438\u0442\u043d\u043e.<\/p>\n<p>  \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432: JavaScript, PHP, Python, Perl.<\/p>\n<pre><code class=\"php\">    $size   = sizeof($arr)-   1                         ;     for ($INDEX_I = $size;    $INDEX_I&gt;=0               ;       $INDEX_I--){     for ($INDEX_J = 0;        $INDEX_J&lt;=($INDEX_I-1)    ;       $INDEX_J++)         if(                   $arr[$INDEX_J]            &gt;       $arr[$INDEX_J+1]){         $k  =                 $arr[$INDEX_J]            ;         $arr[$INDEX_J] =      $arr[$INDEX_J+1]          ;         $arr[$INDEX_J+1] =    $k                        ;                                                         }                                                         } <\/code><\/pre>\n<h4>\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0437\u043c<\/h4>\n<p>  \u041e\u0431\u0449\u0438\u0435 \u0447\u0435\u0440\u0442\u044b:<br \/>  \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0437\u043c\u0443 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435\u043d\u043d\u044b \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0441\u0432\u043e\u0431\u043e\u0434\u0430, \u0437\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0434\u043d\u043e\u0431\u0443\u043a\u0432\u0435\u043d\u043d\u044b\u0435, \u0432 \u043e\u0434\u043d\u043e\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435, \u0447\u0430\u0441\u0442\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435, \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432, \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0446\u0438\u043a\u043b\u044b \u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044f, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0439 \u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432.<\/p>\n<p>  \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432: Perl, Ruby, Python, Haskell, Scala, Erlang, F#.<\/p>\n<pre><code class=\"php\">    for($i=sizeof($M)-1;$i&gt;=0;$i--){      for($j=0;$j&lt;=($i-1);$j++) if($M[$j]&gt;$M[$j+1])         {         list($M[$j],$M[$j+1])=[$M[$j+1],$M[$j]];         }      } <\/code><\/pre>\n<h4>\u042d\u043a\u0441\u043f\u0440\u0435\u0441\u0441\u0438\u043e\u043d\u0438\u0437\u043c<\/h4>\n<p>  \u0411\u0430\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0443\u0440\u043e\u0434\u043b\u0438\u0432\u043e\u0441\u0442\u044c \u0438 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0440\u0435\u0447\u0438\u044f \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u043b\u0438 \u0443 \u044d\u043a\u0441\u043f\u0440\u0435\u0441\u0441\u0438\u043e\u043d\u0438\u0441\u0442\u043e\u0432 \u0447\u0443\u0432\u0441\u0442\u0432\u0430 \u0440\u0430\u0437\u0434\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f, \u0442\u0440\u0435\u0432\u043e\u0433\u0438 \u0438 \u0444\u0440\u0443\u0441\u0442\u0440\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u043b\u0438 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0445\u0430\u0440\u0434\u043a\u043e\u0434\u0430, \u0441\u043f\u0430\u0433\u0435\u0442\u0442\u0438-\u043a\u043e\u0434\u0430, \u0431\u044b\u0441\u0442\u0440\u044b\u0445 \u0438 \u0433\u0440\u0443\u0431\u044b\u0445 \u0445\u0430\u043a\u043e\u0432. \u041f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0435\u043d\u0438\u0435 \u043e\u0442\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0441\u043e\u0431\u043e \u0443\u0440\u043e\u0434\u043b\u0438\u0432\u043e\u043c\u0443 \u043a\u043e\u0434\u0443 \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u0438\u043b\u0438\u0442\u044c \u0432\u043e\u0437\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0430 \u0437\u0440\u0438\u0442\u0435\u043b\u044f, \u043d\u0435 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0440\u0430\u0432\u043d\u043e\u0434\u0443\u0448\u043d\u044b\u043c.<\/p>\n<p>  \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432: C#, Ruby, Common Lisp, PHP, Shen\/Qi II.<\/p>\n<pre><code class=\"html\">&lt;?php $error = null; $query = 'SELECT * FROM prices'; $result = mysql_query($query)     or $error = '\u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0435 \u0443\u0434\u0430\u043b\u0441\u044f: ' . mysql_error(); $arr = []; while ($line =  mysql_fetch_row($result)) {     $arr[] = $line['price']; }  $size = sizeof($arr)-1; for ($i = $size; $i&gt;=0; $i--) {     for ($j = 0; $j&lt;=($i-1); $j++)         if ($arr[$j]&gt;$arr[$j+1]) { $k = $arr[$j]; $arr[$j] = $arr[$j+1]; $arr[$j+1] = $k; } } echo &quot;&lt;ul&gt;&quot;; foreach ($arr =&gt; $v)     echo &quot;&lt;li&gt;&quot;.$v.&quot;&lt;\/li&gt;&quot;; echo &quot;&lt;\/ul&gt;&quot;; ?&gt; &lt;script&gt;     var error = &quot;&lt;?php echo $error?&gt;&quot;;     if (error) alert(&quot;ERROR: &quot; + error); &lt;\/script&gt;  <\/code><\/pre>\n<h4>\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u043e\u043d\u0438\u0437\u043c<\/h4>\n<p>  \u0427\u0435\u0440\u0442\u044b \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u043e\u043d\u0438\u0437\u043c\u0430:<br \/>  \u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u2014 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u0435\u043a\u043e\u0440\u0430\u0446\u0438\u044f \u0432\u043e\u043a\u0440\u0443\u0433 \u0411\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u041e\u0431\u044a\u0435\u043a\u0442\u0430. \u041a\u043e\u0434, \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0433\u0438\u0431\u043a\u043e (\u0438 \u0437\u0430\u043f\u0443\u0442\u0430\u043d\u043e), \u0447\u0442\u043e \u0445\u043e\u0447\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u043b\u0443\u0447\u0448\u0435 \u0443\u0436 \u044d\u0442\u043e \u0431\u044b\u043b hard code.<\/p>\n<p>  \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432: Java, PHP.<br \/>  <img decoding=\"async\" align=\"right\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/7a3\/98e\/dd0\/7a398edd061c095a2855638a23431d5b.png\"\/><br \/>  <b>sort.php<\/b>  <\/p>\n<pre><code class=\"php\">&lt;?php  require_once 'Sorter\/Bubble\/NumericArray.php'; require_once 'Storage\/Array.php';  $bubbleSorter = new Sorter_Bubble_NumericArray();  $storage = new Storage_Array; $storage-&gt;setElements(array(15, 204, 1, 4, 2, 6, 8, 3, 150));  $bubbleSorter-&gt;sort($storage); var_dump($storage-&gt;getElements()); <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Abstract.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">&lt;?php  require_once 'Sorter\/Interface.php';  abstract class Sorter_Bubble_Abstract implements Sorter_Interface {          \/** * * @var Comparator_Interface *\/     protected $_comparator;          \/** * * @var Swapper_Interface *\/     protected $_swapper;          \/** * * @var Storage_Interface *\/     protected $_storage;           \/** * *\/     public function _bubble() {         for ($i = $this-&gt;_storage-&gt;getSize() - 1; $i &gt;= 0; $i--) {             for ($j = 0; $j &lt;= ($i - 1); $j++) {                 if ($this-&gt;_comparator-&gt;isBigger($this-&gt;_storage-&gt;getElementByIndex($j + 1), $this-&gt;_storage-&gt;getElementByIndex($j))) {                     $this-&gt;_swapper-&gt;swap($this-&gt;_storage, $j + 1, $j);                 }             }         }     }  } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">NumericArray.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">&lt;?php  require_once 'Sorter\/Bubble\/Abstract.php'; require_once 'Storage\/Interface.php'; require_once 'Comparator\/Numeric.php'; require_once 'Swapper.php';  class Sorter_Bubble_NumericArray extends Sorter_Bubble_Abstract {          public function sort(\\Storage_Interface &$storage) {         $this-&gt;_storage = $storage;         $this-&gt;_comparator = new Comparator_Numeric();         $this-&gt;_swapper = new Swapper();                  $this-&gt;_bubble();     }      } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <a href=\"https:\/\/github.com\/rnixik\/bubble\">\u0421\u0441\u044b\u043b\u043a\u0430<\/a> \u043d\u0430 \u0432\u0435\u0441\u044c \u043a\u043e\u0434.<\/p>\n<h4>\u041a\u0443\u0431\u0438\u0437\u043c<\/h4>\n<p>  \u041a\u0443\u0431\u0438\u0437\u043c \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u0443\u044e\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u0434\u0447\u0451\u0440\u043a\u043d\u0443\u0442\u043e \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u0444\u043e\u0440\u043c, \u0441\u0442\u0440\u0435\u043c\u043b\u0435\u043d\u0438\u0435\u043c \u00ab\u0440\u0430\u0437\u0434\u0440\u043e\u0431\u0438\u0442\u044c\u00bb \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043d\u0430 \u0441\u0442\u0435\u0440\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b.<\/p>\n<p>  \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432: Perl, Shen\/Qi II, Python.<\/p>\n<pre><code class=\"php\">    $size=          sizeof($arr)-               1;     for($i          =$size;$i&gt;=0;       $i--)   {     for($j          =0;$j&lt;=($i-1);      $j++)            if($arr[$j]       &gt; $arr[$j+1])     {            $k=  $arr[$j];                 $arr[$j]=   $arr[$j+1];                             $arr[$j+1]=  $k;     }     } <\/code><\/pre>\n<h4>\u041f\u043e\u043f-\u0430\u0440\u0442<\/h4>\n<p>  \u041f\u043e\u043f-\u0430\u0440\u0442 \u043e\u0442 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u0433\u043e popular art, \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u043e pop art \u2014 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439, \u043e\u0431\u0449\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u043a\u043e\u0434.<\/p>\n<p>  \u0427\u0435\u0440\u0442\u044b \u043f\u043e\u043f-\u0430\u0440\u0442\u0430:<br \/>  \u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u044f\u0440\u043a\u0438\u0439 \u043a\u043e\u0434, \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u0438 \u043f\u0440\u043e\u0432\u043e\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438, \u043f\u043e\u043f-\u0430\u0440\u0442 \u0432 \u043a\u043e\u0434\u0435 \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0440\u0434\u0438\u043d\u0430\u0440\u043d\u044b\u0445 \u043b\u0438\u0447\u043d\u043e\u0441\u0442\u0435\u0439. \u0427\u0440\u0435\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u0432 \u043f\u043e\u043f-\u0430\u0440\u0442\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u0431\u044b\u0432\u0430\u0435\u0442 \u2014 \u0437\u0434\u0435\u0441\u044c \u0441\u043c\u0435\u0448\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u0438 \u0441\u0442\u0438\u043b\u0438 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041e\u0431\u044b\u0447\u043d\u043e \u0432\u044b\u0440\u0430\u0441\u0442\u0430\u0435\u0442 \u0438\u0437 \u0438\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0432\u043a\u043b\u0430\u0434\u0430.<\/p>\n<p>  \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432: \u0421++, Java, PHP, C#, 1C.<\/p>\n<pre><code class=\"php\">    $CocaCola = sizeof($Elvis)-1;  \/\/ \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 &lt;&lt;---- \u041e\u0422\u041b\u0418\u0427\u041d\u042b\u0419 \u041f\u0420\u0418\u0401\u041c      for ($i = $CocaCola; $i&gt;=0; $i--) {         for ($j = 0; $j&lt;=($i-1); $j++)             if ($Elvis[$j]&gt;$Elvis[$j+1]) {                 \/\/ \u041c\u0435\u043d\u044f\u0435\u043c \u043c\u0435\u0441\u0442\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0435\u0449\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0422\u0410\u041a \u041a\u0420\u0423\u0427\u0415                 $Presley = $Elvis[$j];                 $Elvis[$j] = $Elvis[$j+1]; $Elvis[$j+1] = $Presley;             }     }  <\/code><\/pre>\n<p>  <b>\u0410 \u043a\u0430\u043a\u043e\u0439 \u0441\u0442\u0438\u043b\u044c \u0438 \u0432 \u043a\u0430\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0430\u043c \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f?<\/b><\/p>\n<h5>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b<\/h5>\n<p>  <\/p>\n<ul>\n<li><a href=\"http:\/\/lurkmore.to\/\u0410\u043d\u0442\u0438-\u043f\u0430\u0442\u0442\u0435\u0440\u043d\">\u0410\u043d\u0442\u0438-\u043f\u0430\u0442\u0442\u0435\u0440\u043d<\/a><\/li>\n<li><a href=\"http:\/\/ru.wikipedia.org\/wiki\/\u0428\u0430\u0431\u043b\u043e\u043d:\u041d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f_\u0432_\u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\">\u041d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435<\/a>  <\/li>\n<\/ul>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/225827\/\"> http:\/\/habrahabr.ru\/post\/225827\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">\n<h4>\u041a\u043b\u0430\u0441\u0441\u0438\u043a\u0430<\/h4>\n<p>  \u0421\u0430\u043c\u044b\u0439 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043a\u043e\u0434.<br \/>  <img decoding=\"async\" align=\"right\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/2e6\/1a5\/2f2\/2e61a52f20aa53a7ebf1b6a7dc905dca.png\"\/>  <\/p>\n<pre><code class=\"php\">    $size = sizeof($arr)-1;     for ($i = $size; $i&gt;=0; $i--) {         for ($j = 0; $j&lt;=($i-1); $j++)             if ($arr[$j]&gt;$arr[$j+1]) {                 $k = $arr[$j];                 $arr[$j] = $arr[$j+1];                 $arr[$j+1] = $k;             }     } <\/code><\/pre>\n<h4>\u0411\u0430\u0440\u043e\u043a\u043a\u043e<\/h4>\n<p>  \u0411\u0430\u0440\u043e\u043a\u043a\u043e (\u0438\u0442\u0430\u043b. barocco \u2014 \u00ab\u043f\u0440\u0438\u0447\u0443\u0434\u043b\u0438\u0432\u044b\u0439\u00bb, \u00ab\u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439\u00bb, \u00ab\u0441\u043a\u043b\u043e\u043d\u043d\u044b\u0439 \u043a \u0438\u0437\u043b\u0438\u0448\u0435\u0441\u0442\u0432\u0430\u043c\u00bb)<br \/>  \u0411\u0430\u0440\u043e\u043a\u043a\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435\u043d\u043d\u044b \u043a\u043e\u043d\u0442\u0440\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u044c, \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c, \u0441\u0442\u0440\u0435\u043c\u043b\u0435\u043d\u0438\u0435 \u043a \u0432\u0435\u043b\u0438\u0447\u0438\u044e \u0438 \u043f\u044b\u0448\u043d\u043e\u0441\u0442\u0438 \u043a\u0430\u043a \u0432 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0438, \u0442\u0430\u043a \u0438 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u043a \u0441\u043b\u0438\u044f\u043d\u0438\u044e \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0442\u0438\u043b\u0435\u0439 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041e\u0431\u044b\u0447\u043d\u043e \u0443\u0436\u0435 \u043d\u0430 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u043a\u0440\u044b\u0442\u044b\u0435 \u00ab\u0434\u0435\u0442\u043e\u043d\u0430\u0442\u043e\u0440\u044b\u00bb.<\/p>\n<p>  \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432: JavaScript, C++, Java.<\/p>\n<pre><code class=\"php\">    $SIZE = SIZEof($A_R__R)-1;     for ($i = $SIZE; $i&gt;=0; $i--) {         for ($j = 0; $j&lt;=($i-1); $j++)             if ($A_R__R[$j]&gt;$A_R__R[$j+1]) {                 \/\/\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0445\u0438\u0442\u0440\u044b\u0439 \u043c\u0430\u043d\u0451\u0432\u0440                 $A_R__R[$j+1]  = $A_R__R[$j];  + $A_R__R[$j+1];                 $A_R__R[$j]    = $A_R__R[$j+1] - $A_R__R[$j];                 $A_R__R[$j+1]  = $A_R__R[$j+1] - $A_R__R[$j];              }     } <\/code><\/pre>\n<p>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-225827","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/225827","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=225827"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/225827\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=225827"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=225827"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=225827"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}