{"id":307574,"date":"2020-07-27T21:00:40","date_gmt":"2020-07-27T21:00:40","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=307574"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2020-07-27T21:00:40","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=307574","title":{"rendered":"\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 quadsort"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/512682\/\">\n<h1>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h1>\n<p>  \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u043d\u0435\u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0439 \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0441\u043b\u0438\u044f\u043d\u0438\u0435\u043c \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c quadsort.<\/p>\n<h1>\u0427\u0435\u0442\u0432\u0435\u0440\u043d\u043e\u0439 \u043e\u0431\u043c\u0435\u043d<\/h1>\n<p>  \u0412 \u043e\u0441\u043d\u043e\u0432\u0435 quadsort \u043b\u0435\u0436\u0438\u0442 \u0447\u0435\u0442\u0432\u0435\u0440\u043d\u043e\u0439 \u043e\u0431\u043c\u0435\u043d. \u0422\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u043e\u0431\u043c\u0435\u043d\u0430, \u0433\u0434\u0435 \u0434\u0432\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439. \u041e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">    if (val[0] &gt; val[1])     {         tmp[0] = val[0];         val[0] = val[1];         val[1] = tmp[0];     }<\/code><\/pre>\n<p>  \u0412 \u0447\u0435\u0442\u0432\u0435\u0440\u043d\u043e\u043c \u043e\u0431\u043c\u0435\u043d\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u043f\u043e\u0434\u043c\u0435\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 (\u0441\u0432\u043e\u043f). \u041d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u0447\u0435\u0442\u044b\u0440\u0435 \u0441\u0432\u043e\u043f-\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043e\u043d\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u0447\u0435\u0442\u044b\u0440\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/2b\/ck\/de\/2bckde8np9imips8trkn6svswwg.png\"><br \/>  \u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u043d\u0430 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435 \u0432\u044b\u0448\u0435.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u0430\u0443\u043d\u0434\u0430 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u043e\u0434\u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 if \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043b\u0438 \u0447\u0435\u0442\u044b\u0440\u0435 \u0441\u0432\u043e\u043f-\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0442\u0430\u043a, \u0442\u043e \u043e\u0431\u043c\u0435\u043d \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e. \u0417\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f, \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043b\u0438 \u0441\u0432\u043e\u043f-\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0442\u0430\u043a, \u0442\u043e \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e. \u0415\u0441\u043b\u0438 \u043e\u0431\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0434\u0430\u044e\u0442 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0442\u043e \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u0438 \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0434\u0432\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430.<\/p>\n<p>  \u042d\u0442\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043e\u0434\u043d\u043e \u043b\u0438\u0448\u043d\u0435\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443. \u0412 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043e\u0434\u043d\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043c\u0438\u0440\u0435 \u043c\u044b \u0440\u0435\u0434\u043a\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u0433\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043a\u043e\u0440\u0435\u0435 \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u044b, \u0447\u0435\u043c \u0431\u0435\u0441\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u043d\u044b, \u044d\u0442\u043e\u0442 \u0441\u0434\u0432\u0438\u0433 \u0432 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0434\u0430\u0451\u0442 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e.<\/p>\n<p>  \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u0449\u0435\u0435 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0437\u0430 \u0441\u0447\u0451\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0442\u043e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0432\u043e\u043f\u0430. \u041d\u0430 \u044f\u0437\u044b\u043a\u0435 C \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0447\u0435\u0442\u0432\u0435\u0440\u043d\u043e\u0439 \u0441\u0432\u043e\u043f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">    if (val[0] &gt; val[1])     {         tmp[0] = val[1];         tmp[1] = val[0];     }     else     {         tmp[0] = val[0];         tmp[1] = val[1];     }      if (val[2] &gt; val[3])     {         tmp[2] = val[3];         tmp[3] = val[2];     }     else     {         tmp[2] = val[2];         tmp[3] = val[3];     }      if (tmp[1] &lt;= tmp[2])     {         val[0] = tmp[0];         val[1] = tmp[1];         val[2] = tmp[2];         val[3] = tmp[3];     }     else if (tmp[0] &gt; tmp[3])     {         val[0] = tmp[2];         val[1] = tmp[3];         val[2] = tmp[0];         val[3] = tmp[1];     }     else     {        if (tmp[0] &lt;= tmp[2])        {            val[0] = tmp[0];            val[1] = tmp[2];        }        else        {            val[0] = tmp[2];            val[1] = tmp[0];        }         if (tmp[1] &lt;= tmp[3])        {            val[2] = tmp[1];            val[3] = tmp[3];        }        else        {            val[2] = tmp[3];            val[3] = tmp[1];        }     }<\/code><\/pre>\n<p>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0451\u043d \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0435 \u0447\u0430\u0441\u0442\u0438, \u0445\u0432\u043e\u0441\u0442 \u0438\u0437 1-3 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u043e\u0431\u043c\u0435\u043d\u0430.<\/p>\n<p>  \u041e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u0447\u0435\u0442\u0432\u0435\u0440\u043d\u043e\u0439 \u043e\u0431\u043c\u0435\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0432 quadsort.<\/p>\n<h1>\u0427\u0435\u0442\u0432\u0435\u0440\u043d\u043e\u0435 \u0441\u043b\u0438\u044f\u043d\u0438\u0435<\/h1>\n<p>  \u041d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0447\u0435\u0442\u0432\u0435\u0440\u043d\u043e\u0439 \u043e\u0431\u043c\u0435\u043d \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0451\u0445\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438, \u043a\u0430\u043a \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432\u044b\u0448\u0435.<\/p>\n<p>  \u041d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0445\u043e\u0436\u0438\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u044b\u0445 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0445 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432, \u043d\u043e \u0432 \u0431\u043b\u043e\u043a\u0430\u0445 \u043f\u043e 4, 16, 64 \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u044d\u0442\u043e\u0442 \u044d\u0442\u0430\u043f \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0441\u043b\u0438\u044f\u043d\u0438\u0435\u043c.<\/p>\n<p>  \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"plaintext\">main memory: AAAA BBBB CCCC DDDD  swap memory: ABABABAB  CDCDCDCD  main memory: ABCDABCDABCDABCD<\/code><\/pre>\n<p>  \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0447\u0435\u0442\u0432\u0435\u0440\u043d\u043e\u0439 \u043e\u0431\u043c\u0435\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u0431\u043b\u043e\u043a\u043e\u0432 \u043f\u043e \u0447\u0435\u0442\u044b\u0440\u0435 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c. \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0447\u0435\u0442\u0432\u0435\u0440\u043d\u043e\u0435 \u0441\u043b\u0438\u044f\u043d\u0438\u0435 \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0432 \u0434\u0432\u0430 \u0431\u043b\u043e\u043a\u0430 \u043f\u043e \u0432\u043e\u0441\u0435\u043c\u044c \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u0432 \u0441\u0432\u043e\u043f-\u043f\u0430\u043c\u044f\u0442\u0438. \u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0431\u043b\u043e\u043a\u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c, \u0438 \u043c\u044b \u043e\u0441\u0442\u0430\u0435\u043c\u0441\u044f \u0441 \u043e\u0434\u043d\u0438 \u0431\u043b\u043e\u043a\u043e\u043c \u0438\u0437 16 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kc\/6e\/4j\/kc6e4jcto8xixrze3kgbsnu4vmo.gif\"><\/p>\n<p>  \u042d\u0442\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u0443\u0434\u0432\u043e\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043b\u044f \u0441\u0432\u043e\u043f\u0430. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<h1>\u041f\u0440\u043e\u043f\u0443\u0441\u043a<\/h1>\n<p>  \u0415\u0449\u0451 \u043e\u0434\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0438\u0437-\u0437\u0430 \u0432\u043e\u0437\u0440\u043e\u0441\u0448\u0435\u0439 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441\u043b\u0438\u044f\u043d\u0438\u044f \u0432\u044b\u0433\u043e\u0434\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043b\u0438 \u0447\u0435\u0442\u044b\u0440\u0435 \u0431\u043b\u043e\u043a\u0430 \u0432 \u043f\u0440\u044f\u043c\u043e\u043c \u0438\u043b\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435.<\/p>\n<p>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0447\u0435\u0442\u044b\u0440\u0435 \u0431\u043b\u043e\u043a\u0430 \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u044b, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u043b\u0438\u044f\u043d\u0438\u044f \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e\u0439. \u041e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 if, \u0438 \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u044d\u0442\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 if \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0432\u0441\u0451 \u0431\u043e\u043b\u0435\u0435 \u043c\u0430\u043b\u043e\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0439 \u043f\u043e \u043c\u0435\u0440\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0431\u043b\u043e\u043a\u0430. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 if \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442\u0441\u044f \u0432\u0447\u0435\u0442\u0432\u0435\u0440\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0446\u0438\u043a\u043b, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0432\u044b\u0433\u043e\u0434\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0446\u0438\u043a\u043b \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0447\u0435\u0442\u0432\u0435\u0440\u043e.<\/p>\n<p>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0447\u0435\u0442\u044b\u0440\u0435 \u0431\u043b\u043e\u043a\u0430 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u0441\u0432\u043e\u043f \u043d\u0430 \u043c\u0435\u0441\u0442\u0435.<\/p>\n<p>  \u0412 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430 \u0438\u0437 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u0431\u043b\u043e\u043a\u043e\u0432 \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u044b \u0438\u043b\u0438 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0432 \u0441\u0430\u043c\u043e\u043c \u0441\u043b\u0438\u044f\u043d\u0438\u0438 \u0438\u0437\u043b\u0438\u0448\u043d\u0438 \u0438 \u0432\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u043e\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f. \u0414\u0430\u043d\u043d\u044b\u0435 \u0432\u0441\u0451 \u0435\u0449\u0451 \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0441\u0432\u043e\u043f-\u043f\u0430\u043c\u044f\u0442\u044c, \u043d\u043e \u044d\u0442\u043e \u043c\u0435\u043d\u0435\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430.<\/p>\n<p>  \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0443 quadsort \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 \u043f\u0440\u044f\u043c\u043e\u043c \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <code>n<\/code> \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0432\u043c\u0435\u0441\u0442\u043e <code>n * log n<\/code> \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439.<\/p>\n<h1>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0433\u0440\u0430\u043d\u0438\u0446<\/h1>\n<p>  \u0415\u0449\u0451 \u043e\u0434\u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u043e\u0439 \u0441\u043b\u0438\u044f\u043d\u0438\u0435\u043c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d\u0430 \u0442\u0440\u0430\u0442\u0438\u0442 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u043d\u0430 \u043b\u0438\u0448\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0433\u0440\u0430\u043d\u0438\u0446. \u042d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">    while (a &lt;= a_max &amp;&amp; b &lt;= b_max)         if (a &lt;= b)             [insert a++]         else             [insert b++]<\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430\u0448 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 A \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 B. \u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 A \u043c\u0435\u043d\u044c\u0448\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 B, \u0442\u043e \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 <code>b &lt; b_max<\/code> \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043b\u043e\u0436\u043d\u043e\u0439, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c A \u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e, \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 A \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 B, \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 <code>a &lt; a_max<\/code> \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043b\u043e\u0436\u043d\u043e\u0439. \u042d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">    if (val[a_max] &lt;= val[b_max])         while (a &lt;= a_max)         {             while (a &gt; b)                 [insert b++]             [insert a++]         }     else         while (b &lt;= b_max)         {             while (a &lt;= b)                 [insert a++]             [insert b++]         }<\/code><\/pre>\n<p>  <\/p>\n<h1>\u0421\u043b\u0438\u044f\u043d\u0438\u0435 \u0445\u0432\u043e\u0441\u0442\u0430<\/h1>\n<p>  \u041f\u0440\u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0438\u0437 65 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u044b \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 64 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432 \u043a\u043e\u043d\u0446\u0435. \u042d\u0442\u043e \u043d\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u0432\u043e\u043f\u0430 (\u043e\u0431\u043c\u0435\u043d\u0430), \u0435\u0441\u043b\u0438 \u0432\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435. \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 (64, 256 \u0438\u043b\u0438 1024).<\/p>\n<p>  \u0414\u0440\u0443\u0433\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0435\u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043b\u0438\u0448\u043d\u0438\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c \u043e\u0431\u043c\u0435\u043d\u0430. \u0427\u0442\u043e\u0431\u044b \u043e\u0431\u043e\u0439\u0442\u0438 \u044d\u0442\u0438 \u0434\u0432\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u0447\u0435\u0442\u0432\u0435\u0440\u043d\u043e\u0433\u043e \u0441\u043b\u0438\u044f\u043d\u0438\u044f \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u043b\u043e\u043a\u0430 \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442 1\/8 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0438\u044f\u043d\u0438\u044f \u0445\u0432\u043e\u0441\u0442\u0430. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u0441\u043b\u0438\u044f\u043d\u0438\u044f \u0445\u0432\u043e\u0441\u0442\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u043e\u0431\u044a\u0451\u043c \u0441\u0432\u043e\u043f\u0430 quadsort \u0434\u043e n\/2 \u0431\u0435\u0437 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u043b\u0438\u044f\u043d\u0438\u044f \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<h1>Big O<\/h1>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th>\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435<\/th>\n<th>\u041b\u0443\u0447\u0448\u0438\u0439<\/th>\n<th>\u0421\u0440\u0435\u0434\u043d\u0438\u0439<\/th>\n<th>\u0425\u0443\u0434\u0448\u0438\u0439<\/th>\n<th>\u0421\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0439<\/th>\n<th>\u041f\u0430\u043c\u044f\u0442\u044c<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>quadsort<\/td>\n<td>n<\/td>\n<td>n log n<\/td>\n<td>n log n<\/td>\n<td>\u0434\u0430<\/td>\n<td>n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>  \u041a\u043e\u0433\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u0443\u0436\u0435 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0438\u043b\u0438 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435, quadsort \u0441\u043e\u0432\u0435\u0440\u0448\u0430\u0435\u0442 n \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439.<\/p>\n<h1>\u041a\u044d\u0448<\/h1>\n<p>  \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 quadsort \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 n\/2 \u043e\u0431\u044a\u0451\u043c\u0430 \u0441\u0432\u043e\u043f-\u043f\u0430\u043c\u044f\u0442\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u044d\u0448\u0430 \u043d\u0435 \u0442\u0430\u043a \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e, \u043a\u0430\u043a \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435. \u041e\u0434\u043d\u0430\u043a\u043e \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043d\u0435\u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u043e\u0431\u043c\u0435\u043d\u0443. \u041e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u044f\u0441\u044c \u043d\u0430 \u043c\u043e\u0438\u0445 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430\u0445, quadsort \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435, \u0435\u0441\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0435 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043a\u044d\u0448 L1, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u0445 \u043c\u043e\u0436\u0435\u0442 \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0442\u044c 64\u00a0\u041a\u0411.<\/p>\n<h1>Wolfsort<\/h1>\n<p>  <a href=\"https:\/\/github.com\/scandum\/wolfsort\" rel=\"nofollow\">Wolfsort<\/a> \u2014 \u044d\u0442\u043e \u0433\u0438\u0431\u0440\u0438\u0434\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 radixsort\/quadsort, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043b\u0443\u0447\u0448\u0430\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u042d\u0442\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u043c\u0438 32-\u0438 64-\u0431\u0438\u0442\u043d\u044b\u043c\u0438 \u0446\u0435\u043b\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438.<\/p>\n<h1>\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h1>\n<p>  \u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u0439 \u043d\u0438\u0436\u0435 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0447\u0435\u0442\u044b\u0440\u0435 \u0442\u0435\u0441\u0442\u0430. \u041f\u0435\u0440\u0432\u044b\u0439 \u0442\u0435\u0441\u0442 \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438, \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u043d\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e, \u0442\u0440\u0435\u0442\u0438\u0439 \u2014 \u043d\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u043f\u043e \u0443\u0431\u044b\u0432\u0430\u043d\u0438\u044e, \u0447\u0435\u0442\u0432\u0451\u0440\u0442\u044b\u0439\u00a0\u2014 \u043d\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e \u0441\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u0445\u0432\u043e\u0441\u0442\u043e\u043c.<\/p>\n<p>  \u0412\u0435\u0440\u0445\u043d\u044f\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u0432\u043e\u043f, \u0430 \u043d\u0438\u0436\u043d\u044f\u044f \u2014 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c. \u0426\u0432\u0435\u0442\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430, \u0441\u0432\u043e\u043f\u0430, \u0441\u043b\u0438\u044f\u043d\u0438\u044f \u0438 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/lr\/rc\/bj\/lrrcbj_fr5trj1znzqt3hfgwf8s.gif\"><\/p>\n<h1>\u0411\u0435\u043d\u0447\u043c\u0430\u0440\u043a: quadsort, std::stable_sort, timsort, pdqsort \u0438 wolfsort<\/h1>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a \u0431\u044b\u043b \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u043d\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 WSL gcc \u0432\u0435\u0440\u0441\u0438\u0438 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1). \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <code>g++ -O3 quadsort.cpp<\/code>. \u041a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u0441\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0441\u0442\u043e \u0440\u0430\u0437, \u0438 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e \u043b\u0443\u0447\u0448\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435.<\/p>\n<p>  \u041f\u043e \u043e\u0441\u0438 \u0430\u0431\u0441\u0446\u0438\u0441\u0441 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/6m\/bj\/-8\/6mbj-86wcjactjt9zsbhlpowfdu.png\"><\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 quadsort, std::stable_sort, timsort, pdqsort \u0438 wolfsort<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th>\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435<\/th>\n<th>\u042d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432<\/th>\n<th>\u0422\u0438\u043f<\/th>\n<th>\u041b\u0443\u0447\u0448\u0438\u0439<\/th>\n<th>\u0421\u0440\u0435\u0434\u043d\u0438\u0439<\/th>\n<th>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439<\/th>\n<th>\u041f\u043e\u0440\u044f\u0434\u043e\u043a<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>quadsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.070469<\/td>\n<td>0.070635<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>stablesort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.073865<\/td>\n<td>0.074078<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>timsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.089192<\/td>\n<td>0.089301<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>pdqsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.029911<\/td>\n<td>0.029948<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>wolfsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.017359<\/td>\n<td>0.017744<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>quadsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.000485<\/td>\n<td>0.000511<\/td>\n<td><\/td>\n<td>\u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u0435<\/td>\n<\/tr>\n<tr>\n<td>stablesort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.010188<\/td>\n<td>0.010261<\/td>\n<td><\/td>\n<td>\u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u0435<\/td>\n<\/tr>\n<tr>\n<td>timsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.000331<\/td>\n<td>0.000342<\/td>\n<td><\/td>\n<td>\u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u0435<\/td>\n<\/tr>\n<tr>\n<td>pdqsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.000863<\/td>\n<td>0.000875<\/td>\n<td><\/td>\n<td>\u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u0435<\/td>\n<\/tr>\n<tr>\n<td>wolfsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.000539<\/td>\n<td>0.000579<\/td>\n<td><\/td>\n<td>\u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u0435<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>quadsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.008901<\/td>\n<td>0.008934<\/td>\n<td><\/td>\n<td>\u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u0435 \u0441\u0442\u0443\u043f\u0435\u043d\u044c\u043a\u0430\u043c\u0438 (\u043f\u0438\u043b\u043e\u0439)<\/td>\n<\/tr>\n<tr>\n<td>stablesort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.017093<\/td>\n<td>0.017275<\/td>\n<td><\/td>\n<td>\u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u0435 \u0441\u0442\u0443\u043f\u0435\u043d\u044c\u043a\u0430\u043c\u0438 (\u043f\u0438\u043b\u043e\u0439)<\/td>\n<\/tr>\n<tr>\n<td>timsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.008615<\/td>\n<td>0.008674<\/td>\n<td><\/td>\n<td>\u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u0435 \u0441\u0442\u0443\u043f\u0435\u043d\u044c\u043a\u0430\u043c\u0438 (\u043f\u0438\u043b\u043e\u0439)<\/td>\n<\/tr>\n<tr>\n<td>pdqsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.047785<\/td>\n<td>0.047921<\/td>\n<td><\/td>\n<td>\u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u0435 \u0441\u0442\u0443\u043f\u0435\u043d\u044c\u043a\u0430\u043c\u0438 (\u043f\u0438\u043b\u043e\u0439)<\/td>\n<\/tr>\n<tr>\n<td>wolfsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.012490<\/td>\n<td>0.012554<\/td>\n<td><\/td>\n<td>\u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u0435 \u0441\u0442\u0443\u043f\u0435\u043d\u044c\u043a\u0430\u043c\u0438 (\u043f\u0438\u043b\u043e\u0439)<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>quadsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.038260<\/td>\n<td>0.038343<\/td>\n<td><\/td>\n<td>\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>stablesort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.042292<\/td>\n<td>0.042388<\/td>\n<td><\/td>\n<td>\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>timsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.055855<\/td>\n<td>0.055967<\/td>\n<td><\/td>\n<td>\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>pdqsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.008093<\/td>\n<td>0.008168<\/td>\n<td><\/td>\n<td>\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>wolfsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.038320<\/td>\n<td>0.038417<\/td>\n<td><\/td>\n<td>\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>quadsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.000559<\/td>\n<td>0.000576<\/td>\n<td><\/td>\n<td>\u0443\u0431\u044b\u0432\u0430\u043d\u0438\u0435<\/td>\n<\/tr>\n<tr>\n<td>stablesort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.010343<\/td>\n<td>0.010438<\/td>\n<td><\/td>\n<td>\u0443\u0431\u044b\u0432\u0430\u043d\u0438\u0435<\/td>\n<\/tr>\n<tr>\n<td>timsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.000891<\/td>\n<td>0.000900<\/td>\n<td><\/td>\n<td>\u0443\u0431\u044b\u0432\u0430\u043d\u0438\u0435<\/td>\n<\/tr>\n<tr>\n<td>pdqsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.001882<\/td>\n<td>0.001897<\/td>\n<td><\/td>\n<td>\u0443\u0431\u044b\u0432\u0430\u043d\u0438\u0435<\/td>\n<\/tr>\n<tr>\n<td>wolfsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.000604<\/td>\n<td>0.000625<\/td>\n<td><\/td>\n<td>\u0443\u0431\u044b\u0432\u0430\u043d\u0438\u0435<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>quadsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.006174<\/td>\n<td>0.006245<\/td>\n<td><\/td>\n<td>\u0443\u0431\u044b\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0443\u043f\u0435\u043d\u044c\u043a\u0430\u043c\u0438<\/td>\n<\/tr>\n<tr>\n<td>stablesort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.014679<\/td>\n<td>0.014767<\/td>\n<td><\/td>\n<td>\u0443\u0431\u044b\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0443\u043f\u0435\u043d\u044c\u043a\u0430\u043c\u0438<\/td>\n<\/tr>\n<tr>\n<td>timsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.006419<\/td>\n<td>0.006468<\/td>\n<td><\/td>\n<td>\u0443\u0431\u044b\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0443\u043f\u0435\u043d\u044c\u043a\u0430\u043c\u0438<\/td>\n<\/tr>\n<tr>\n<td>pdqsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.016603<\/td>\n<td>0.016629<\/td>\n<td><\/td>\n<td>\u0443\u0431\u044b\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0443\u043f\u0435\u043d\u044c\u043a\u0430\u043c\u0438<\/td>\n<\/tr>\n<tr>\n<td>wolfsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.006264<\/td>\n<td>0.006329<\/td>\n<td><\/td>\n<td>\u0443\u0431\u044b\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0443\u043f\u0435\u043d\u044c\u043a\u0430\u043c\u0438<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>quadsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.018675<\/td>\n<td>0.018729<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0445\u0432\u043e\u0441\u0442<\/td>\n<\/tr>\n<tr>\n<td>stablesort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.026384<\/td>\n<td>0.026508<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0445\u0432\u043e\u0441\u0442<\/td>\n<\/tr>\n<tr>\n<td>timsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.023226<\/td>\n<td>0.023395<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0445\u0432\u043e\u0441\u0442<\/td>\n<\/tr>\n<tr>\n<td>pdqsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.028599<\/td>\n<td>0.028674<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0445\u0432\u043e\u0441\u0442<\/td>\n<\/tr>\n<tr>\n<td>wolfsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.009517<\/td>\n<td>0.009631<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0445\u0432\u043e\u0441\u0442<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>quadsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.037593<\/td>\n<td>0.037679<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430<\/td>\n<\/tr>\n<tr>\n<td>stablesort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.043755<\/td>\n<td>0.043899<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430<\/td>\n<\/tr>\n<tr>\n<td>timsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.047008<\/td>\n<td>0.047112<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430<\/td>\n<\/tr>\n<tr>\n<td>pdqsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.029800<\/td>\n<td>0.029847<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430<\/td>\n<\/tr>\n<tr>\n<td>wolfsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.013238<\/td>\n<td>0.013355<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>quadsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.009605<\/td>\n<td>0.009673<\/td>\n<td><\/td>\n<td>\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u043e\u043b\u043d\u0430\u043c\u0438<\/td>\n<\/tr>\n<tr>\n<td>stablesort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.013667<\/td>\n<td>0.013785<\/td>\n<td><\/td>\n<td>\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u043e\u043b\u043d\u0430\u043c\u0438<\/td>\n<\/tr>\n<tr>\n<td>timsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.007994<\/td>\n<td>0.008138<\/td>\n<td><\/td>\n<td>\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u043e\u043b\u043d\u0430\u043c\u0438<\/td>\n<\/tr>\n<tr>\n<td>pdqsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.024683<\/td>\n<td>0.024727<\/td>\n<td><\/td>\n<td>\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u043e\u043b\u043d\u0430\u043c\u0438<\/td>\n<\/tr>\n<tr>\n<td>wolfsort<\/td>\n<td>1000000<\/td>\n<td>i32<\/td>\n<td>0.009642<\/td>\n<td>0.009709<\/td>\n<td><\/td>\n<td>\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u043e\u043b\u043d\u0430\u043c\u0438<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div><\/div>\n<p>  \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e pdqsort \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u043e\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 (\u043e\u0431\u0449\u0438\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a).<\/p>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0441\u044f \u043d\u0430 WSL gcc \u0432\u0435\u0440\u0441\u0438\u0438 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1). \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <code>g++ -O3 quadsort.cpp<\/code>. \u041a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u0441\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0441\u0442\u043e \u0440\u0430\u0437, \u0438 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e \u043b\u0443\u0447\u0448\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435. \u041e\u043d \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u043e\u0442 675 \u0434\u043e 100\u00a0000 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  \u041e\u0441\u044c X \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u0433\u043e \u043d\u0438\u0436\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u2014 \u044d\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043e\u0441\u044c Y \u2014 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/k3\/4i\/ss\/k34issozpvqj2_1uoou9f0uslbg.png\"><\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 quadsort, std::stable_sort, timsort, pdqsort \u0438 wolfsort<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th>\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435<\/th>\n<th>\u042d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432<\/th>\n<th>\u0422\u0438\u043f<\/th>\n<th>\u041b\u0443\u0447\u0448\u0438\u0439<\/th>\n<th>\u0421\u0440\u0435\u0434\u043d\u0438\u0439<\/th>\n<th>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439<\/th>\n<th>\u041f\u043e\u0440\u044f\u0434\u043e\u043a<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>quadsort<\/td>\n<td>100000<\/td>\n<td>i32<\/td>\n<td>0.005800<\/td>\n<td>0.005835<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>stablesort<\/td>\n<td>100000<\/td>\n<td>i32<\/td>\n<td>0.006092<\/td>\n<td>0.006122<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>timsort<\/td>\n<td>100000<\/td>\n<td>i32<\/td>\n<td>0.007605<\/td>\n<td>0.007656<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>pdqsort<\/td>\n<td>100000<\/td>\n<td>i32<\/td>\n<td>0.002648<\/td>\n<td>0.002670<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>wolfsort<\/td>\n<td>100000<\/td>\n<td>i32<\/td>\n<td>0.001148<\/td>\n<td>0.001168<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>quadsort<\/td>\n<td>10000<\/td>\n<td>i32<\/td>\n<td>0.004568<\/td>\n<td>0.004593<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>stablesort<\/td>\n<td>10000<\/td>\n<td>i32<\/td>\n<td>0.004813<\/td>\n<td>0.004923<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>timsort<\/td>\n<td>10000<\/td>\n<td>i32<\/td>\n<td>0.006326<\/td>\n<td>0.006376<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>pdqsort<\/td>\n<td>10000<\/td>\n<td>i32<\/td>\n<td>0.002345<\/td>\n<td>0.002373<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>wolfsort<\/td>\n<td>10000<\/td>\n<td>i32<\/td>\n<td>0.001256<\/td>\n<td>0.001274<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>quadsort<\/td>\n<td>5000<\/td>\n<td>i32<\/td>\n<td>0.004076<\/td>\n<td>0.004086<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>stablesort<\/td>\n<td>5000<\/td>\n<td>i32<\/td>\n<td>0.004394<\/td>\n<td>0.004420<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>timsort<\/td>\n<td>5000<\/td>\n<td>i32<\/td>\n<td>0.005901<\/td>\n<td>0.005938<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>pdqsort<\/td>\n<td>5000<\/td>\n<td>i32<\/td>\n<td>0.002093<\/td>\n<td>0.002107<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>wolfsort<\/td>\n<td>5000<\/td>\n<td>i32<\/td>\n<td>0.000968<\/td>\n<td>0.001086<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>quadsort<\/td>\n<td>2500<\/td>\n<td>i32<\/td>\n<td>0.003196<\/td>\n<td>0.003303<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>stablesort<\/td>\n<td>2500<\/td>\n<td>i32<\/td>\n<td>0.003801<\/td>\n<td>0.003942<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>timsort<\/td>\n<td>2500<\/td>\n<td>i32<\/td>\n<td>0.005296<\/td>\n<td>0.005322<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>pdqsort<\/td>\n<td>2500<\/td>\n<td>i32<\/td>\n<td>0.001606<\/td>\n<td>0.001661<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>wolfsort<\/td>\n<td>2500<\/td>\n<td>i32<\/td>\n<td>0.000509<\/td>\n<td>0.000520<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>quadsort<\/td>\n<td>1250<\/td>\n<td>i32<\/td>\n<td>0.001767<\/td>\n<td>0.001823<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>stablesort<\/td>\n<td>1250<\/td>\n<td>i32<\/td>\n<td>0.002812<\/td>\n<td>0.002887<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>timsort<\/td>\n<td>1250<\/td>\n<td>i32<\/td>\n<td>0.003789<\/td>\n<td>0.003865<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>pdqsort<\/td>\n<td>1250<\/td>\n<td>i32<\/td>\n<td>0.001036<\/td>\n<td>0.001325<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>wolfsort<\/td>\n<td>1250<\/td>\n<td>i32<\/td>\n<td>0.000534<\/td>\n<td>0.000655<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>quadsort<\/td>\n<td>675<\/td>\n<td>i32<\/td>\n<td>0.000368<\/td>\n<td>0.000592<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>stablesort<\/td>\n<td>675<\/td>\n<td>i32<\/td>\n<td>0.000974<\/td>\n<td>0.001160<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>timsort<\/td>\n<td>675<\/td>\n<td>i32<\/td>\n<td>0.000896<\/td>\n<td>0.000948<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>pdqsort<\/td>\n<td>675<\/td>\n<td>i32<\/td>\n<td>0.000489<\/td>\n<td>0.000531<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<tr>\n<td>wolfsort<\/td>\n<td>675<\/td>\n<td>i32<\/td>\n<td>0.000283<\/td>\n<td>0.000308<\/td>\n<td><\/td>\n<td>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div><\/div>\n<p>  <\/p>\n<h1>\u0411\u0435\u043d\u0447\u043c\u0430\u0440\u043a: quadsort \u0438 qsort (mergesort)<\/h1>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0441\u044f \u043d\u0430 WSL gcc \u0432\u0435\u0440\u0441\u0438\u0438 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1). \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <code>g++ -O3 quadsort.cpp<\/code>. \u041a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u0441\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0441\u0442\u043e \u0440\u0430\u0437, \u0438 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e \u043b\u0443\u0447\u0448\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435. <\/p>\n<pre><code class=\"plaintext\">         quadsort: sorted 1000000 i32s in 0.119437 seconds. MO:   19308657 (\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a)             qsort: sorted 1000000 i32s in 0.133077 seconds. MO:   21083741 (\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a)           quadsort: sorted 1000000 i32s in 0.002071 seconds. MO:     999999 (\u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u0435)             qsort: sorted 1000000 i32s in 0.007265 seconds. MO:    3000004 (\u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u0435)           quadsort: sorted 1000000 i32s in 0.019239 seconds. MO:    4007580 (\u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u0435 \u0441\u0442\u0443\u043f\u0435\u043d\u044f\u043c\u0438)             qsort: sorted 1000000 i32s in 0.071322 seconds. MO:   20665677 (\u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u0435 \u0441\u0442\u0443\u043f\u0435\u043d\u044f\u043c\u0438)           quadsort: sorted 1000000 i32s in 0.076605 seconds. MO:   19242642 (\u043e\u0431\u0449\u0438\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a)             qsort: sorted 1000000 i32s in 0.038389 seconds. MO:    6221917 (\u043e\u0431\u0449\u0438\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a)           quadsort: sorted 1000000 i32s in 0.002305 seconds. MO:     999999 (\u0443\u0431\u044b\u0432\u0430\u043d\u0438\u0435)             qsort: sorted 1000000 i32s in 0.009659 seconds. MO:    4000015 (\u0443\u0431\u044b\u0432\u0430\u043d\u0438\u0435)           quadsort: sorted 1000000 i32s in 0.022940 seconds. MO:    9519209 (\u0443\u0431\u044b\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0443\u043f\u0435\u043d\u044f\u043c\u0438)             qsort: sorted 1000000 i32s in 0.042135 seconds. MO:   13152042 (\u0443\u0431\u044b\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0443\u043f\u0435\u043d\u044f\u043c\u0438)           quadsort: sorted 1000000 i32s in 0.034456 seconds. MO:    6787656 (\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0445\u0432\u043e\u0441\u0442)             qsort: sorted 1000000 i32s in 0.098691 seconds. MO:   20584424 (\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0445\u0432\u043e\u0441\u0442)           quadsort: sorted 1000000 i32s in 0.066240 seconds. MO:   11383441 (\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430)             qsort: sorted 1000000 i32s in 0.118086 seconds. MO:   20572142 (\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430)           quadsort: sorted 1000000 i32s in 0.038116 seconds. MO:   15328606 (\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u043e\u043b\u043d\u0430\u043c\u0438)             qsort: sorted 1000000 i32s in 4.471858 seconds. MO: 1974047339 (\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u043e\u043b\u043d\u0430\u043c\u0438)           quadsort: sorted 1000000 i32s in 0.060989 seconds. MO:   15328606 (\u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0439)             qsort: sorted 1000000 i32s in 0.043175 seconds. MO:   10333679 (\u043d\u0435\u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0439)           quadsort: sorted    1023 i32s in 0.016126 seconds.       (random 1-1023)             qsort: sorted    1023 i32s in 0.033132 seconds.       (random 1-1023)<\/code><\/pre>\n<p>  \u041f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c MO \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439, \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f 1 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  \u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u043c \u0432\u044b\u0448\u0435 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0435 quadsort \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 glibc qsort() \u0447\u0435\u0440\u0435\u0437 \u0442\u043e\u0442 \u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043e\u0431\u0449\u0435\u0433\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u0431\u0435\u0437 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u043d\u0435\u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u044b\u0445 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0438\u043d\u043b\u0430\u0439\u043d\u0438\u043d\u0433.<\/p>\n<pre><code class=\"plaintext\">     random order: 635, 202,  47, 229, etc   ascending order: 1, 2, 3, 4, etc     uniform order: 1, 1, 1, 1, etc  descending order: 999, 998, 997, 996, etc        wave order: 100, 1, 102, 2, 103, 3, etc   stable\/unstable: 100, 1, 102, 1, 103, 1, etc      random range: time to sort 1000 arrays ranging from size 0 to 999 containing random data<\/code><\/pre>\n<p>  <\/p>\n<h1>\u0411\u0435\u043d\u0447\u043c\u0430\u0440\u043a: quadsort \u0438 qsort (quicksort)<\/h1>\n<p>  \u042d\u0442\u043e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 qsort() \u043e\u0442 Cygwin, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 quicksort. \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <code>gcc -O3 quadsort.c<\/code>. \u041a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u0441\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0441\u0442\u043e \u0440\u0430\u0437, \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e \u043b\u0443\u0447\u0448\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435.<\/p>\n<pre><code class=\"plaintext\">         quadsort: sorted 1000000 i32s in 0.119437 seconds. MO:   19308657 (\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a)             qsort: sorted 1000000 i32s in 0.133077 seconds. MO:   21083741 (\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a)           quadsort: sorted 1000000 i32s in 0.002071 seconds. MO:     999999 (\u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u0435)             qsort: sorted 1000000 i32s in 0.007265 seconds. MO:    3000004 (\u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u0435)           quadsort: sorted 1000000 i32s in 0.019239 seconds. MO:    4007580 (\u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u0435 \u0441\u0442\u0443\u043f\u0435\u043d\u044f\u043c\u0438)             qsort: sorted 1000000 i32s in 0.071322 seconds. MO:   20665677 (\u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u0435 \u0441\u0442\u0443\u043f\u0435\u043d\u044f\u043c\u0438)           quadsort: sorted 1000000 i32s in 0.076605 seconds. MO:   19242642 (\u043e\u0431\u0449\u0438\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a)             qsort: sorted 1000000 i32s in 0.038389 seconds. MO:    6221917 (\u043e\u0431\u0449\u0438\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a)           quadsort: sorted 1000000 i32s in 0.002305 seconds. MO:     999999 (\u0443\u0431\u044b\u0432\u0430\u043d\u0438\u0435)             qsort: sorted 1000000 i32s in 0.009659 seconds. MO:    4000015 (\u0443\u0431\u044b\u0432\u0430\u043d\u0438\u0435)           quadsort: sorted 1000000 i32s in 0.022940 seconds. MO:    9519209 (\u0443\u0431\u044b\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0443\u043f\u0435\u043d\u044f\u043c\u0438)             qsort: sorted 1000000 i32s in 0.042135 seconds. MO:   13152042 (\u0443\u0431\u044b\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0443\u043f\u0435\u043d\u044f\u043c\u0438)           quadsort: sorted 1000000 i32s in 0.034456 seconds. MO:    6787656 (\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0445\u0432\u043e\u0441\u0442)             qsort: sorted 1000000 i32s in 0.098691 seconds. MO:   20584424 (\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0445\u0432\u043e\u0441\u0442)           quadsort: sorted 1000000 i32s in 0.066240 seconds. MO:   11383441 (\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430)             qsort: sorted 1000000 i32s in 0.118086 seconds. MO:   20572142 (\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430)           quadsort: sorted 1000000 i32s in 0.038116 seconds. MO:   15328606 (\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u043e\u043b\u043d\u0430\u043c\u0438)             qsort: sorted 1000000 i32s in 4.471858 seconds. MO: 1974047339 (\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u043e\u043b\u043d\u0430\u043c\u0438)           quadsort: sorted 1000000 i32s in 0.060989 seconds. MO:   15328606 (\u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0439)             qsort: sorted 1000000 i32s in 0.043175 seconds. MO:   10333679 (\u043d\u0435\u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0439)           quadsort: sorted    1023 i32s in 0.016126 seconds.       (random 1-1023)             qsort: sorted    1023 i32s in 0.033132 seconds.       (random 1-1023)<\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u044f\u0441\u043d\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 quicksort \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u0435\u0435 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0441\u043b\u0438\u044f\u043d\u0438\u044f, \u043e\u043d \u0434\u0435\u043b\u0430\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u044e\u0449\u0435\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0438 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0443\u0431\u044b\u0432\u0430\u044e\u0449\u0435\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0442\u0435\u0441\u0442\u043e\u0432 \u043e\u043d \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u0441\u0435\u0431\u044f \u0445\u0443\u0436\u0435, \u0447\u0435\u043c quadsort. Quicksort \u0442\u0430\u043a\u0436\u0435 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0447\u0440\u0435\u0437\u0432\u044b\u0447\u0430\u0439\u043d\u043e \u043d\u0438\u0437\u043a\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u044b\u0445 \u0432\u043e\u043b\u043d\u0430\u043c\u0438. \u0422\u0435\u0441\u0442 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e quadsort \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u0432 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043f\u0440\u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432.<\/p>\n<p>  Quicksort \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0432 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0445 \u0438 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u0430\u0445, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435\u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c.<\/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=\"https:\/\/habr.com\/ru\/post\/512682\/\"> https:\/\/habr.com\/ru\/post\/512682\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/512682\/\">\n<h1>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h1>\n<p>  \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u043d\u0435\u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0439 \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0441\u043b\u0438\u044f\u043d\u0438\u0435\u043c \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c quadsort.<\/p>\n<h1>\u0427\u0435\u0442\u0432\u0435\u0440\u043d\u043e\u0439 \u043e\u0431\u043c\u0435\u043d<\/h1>\n<p>  \u0412 \u043e\u0441\u043d\u043e\u0432\u0435 quadsort \u043b\u0435\u0436\u0438\u0442 \u0447\u0435\u0442\u0432\u0435\u0440\u043d\u043e\u0439 \u043e\u0431\u043c\u0435\u043d. \u0422\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u043e\u0431\u043c\u0435\u043d\u0430, \u0433\u0434\u0435 \u0434\u0432\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439. \u041e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">    if (val[0] &gt; val[1])     {         tmp[0] = val[0];         val[0] = val[1];         val[1] = tmp[0];     }<\/code><\/pre>\n<p>  \u0412 \u0447\u0435\u0442\u0432\u0435\u0440\u043d\u043e\u043c \u043e\u0431\u043c\u0435\u043d\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u043f\u043e\u0434\u043c\u0435\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 (\u0441\u0432\u043e\u043f). \u041d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u0447\u0435\u0442\u044b\u0440\u0435 \u0441\u0432\u043e\u043f-\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043e\u043d\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u0447\u0435\u0442\u044b\u0440\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/2b\/ck\/de\/2bckde8np9imips8trkn6svswwg.png\"><br \/>  \u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u043d\u0430 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435 \u0432\u044b\u0448\u0435.  <\/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-307574","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307574","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=307574"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307574\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=307574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=307574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=307574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}