{"id":317677,"date":"2021-02-08T21:00:24","date_gmt":"2021-02-08T21:00:24","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=317677"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=317677","title":{"rendered":"\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043e\u043a \u043d\u0430 \u0421++"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0432\u043e\u043f\u0440\u043e\u0441\u0443 \u0443\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0433\u0443\u0433\u043b\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441.<\/p>\n<p>  \u041a\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u044f \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043b \u043f\u0430\u0440\u0443 \u0440\u0430\u0437. \u0412\u0441\u0435\u0433\u0434\u0430 \u0431\u044b\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0434\u0440\u0443\u0433\u043e\u0439. \u0418\u0445 \u043a\u0430\u043a \u0431\u044b \u0432\u0441\u0435 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u044b \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442, \u043d\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u0441\u0435\u0432\u0434\u043e\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043d\u0430 \u043b\u0435\u043a\u0446\u0438\u0438 \u0432 \u043a\u043e\u0434 \u043d\u0430 \u043a\u0430\u043a\u043e\u043c-\u043d\u0438\u0431\u0443\u0434\u044c \u044f\u0437\u044b\u043a\u0435. \u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0434\u043b\u044f \u043a\u0430\u043a\u043e\u0433\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430.<br \/>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c 5 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043e\u043a. \u042d\u0442\u043e \u043f\u0443\u0437\u044b\u0440\u044c\u043a\u043e\u0432\u0430\u044f(bubble), \u0448\u0435\u0439\u043a\u0435\u0440\u043d\u0430\u044f(shake), \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u0430\u043b\u044c\u043d\u0430\u044f(heap), \u0432\u0441\u0442\u0430\u0432\u043a\u0430\u043c\u0438(insertion) \u0438 \u0431\u044b\u0441\u0442\u0440\u0430\u044f(quick).<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0414\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0438\u0445 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f clock() \u0434\u043e \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u043e\u043d\u0430 \u0436\u0435 \u043f\u043e\u0441\u043b\u0435, \u043f\u043e\u0442\u043e\u043c \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0438\u0445 \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c \u0438 \u043c\u044b \u0443\u0437\u043d\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438. \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b 100 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u043f\u043e 1000 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0432\u0435\u043a\u0442\u043e\u0440\u0430\u0445 \u0438 \u043e\u0434\u043d\u043e\u043c \u043b\u0438\u0441\u0442\u0435 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 sort() \u0438\u0437 stl. \u041a\u0430\u0436\u0434\u043e\u0439 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0435 \u0434\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u0440\u0430\u0437\u0431\u0440\u043e\u0441\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c \u0447\u0438\u0441\u043b\u0430 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438. \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e mean \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043f\u043e \u0438\u0442\u043e\u0433\u0443 \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439. \u0422\u0430\u043a \u043c\u044b \u0443\u0437\u043d\u0430\u0435\u043c \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u0441\u043c\u043e\u0436\u0435\u043c \u0432 \u0438\u0442\u043e\u0433\u0435 \u0438\u0445 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u043f\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043f\u0440\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u0430\u043d\u043d\u044b\u0435 \u0432\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 rand().<\/p>\n<p>  \u0424\u0430\u0439\u043b Sorts.h:<\/p>\n<pre><code class=\"cpp\">#pragma once #include &lt;iostream&gt; #include &lt;list&gt; #include &lt;vector&gt;  #include &lt;iterator&gt; template &lt;typename T&gt; class Sorts { public: \tstd::list&lt;T&gt; arrayList; \tstd::vector&lt;T&gt; bubbleArray,insertionArray,heapArray,shakeArray; \tfloat BubbleSort() \t{ \t\tstd::cout &lt;&lt;&quot;Time to Bubble&gt;&quot; &lt;&lt; std::endl; \t\tunsigned int start_time = clock(); \/\/ \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \t\tint size = bubbleArray.size(); \t\tfor (int i = 1; i &lt; size; i++) \t\t\tfor (int j = size-1; j &gt;=i; j--) \t\t\t\tif (bubbleArray[j-1] &gt; bubbleArray[j]) \t\t\t\t\tswap(&amp;bubbleArray, j - 1, j); \t\tunsigned int end_time = clock(); \/\/ \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \t\tunsigned int search_time = end_time - start_time; \/\/ \u0438\u0441\u043a\u043e\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \t\tstd::cout &lt;&lt; (float)search_time \/ CLOCKS_PER_SEC &lt;&lt; std::endl; \t\treturn (float)search_time \/ CLOCKS_PER_SEC; \t} \tfloat InsertionSort() \t{ \t\tstd::cout &lt;&lt; &quot;Time to Insertion&gt;&quot; &lt;&lt; std::endl; \t\tunsigned int start_time = clock(); \/\/ \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \t\tint size = insertionArray.size(); \t\tfor (int i = 1; i &lt; size; i++) \t\t{ \t\t\tT tmp = insertionArray[i]; \t\t\tint j = i; \t\t\twhile (j &gt; 0 &amp;&amp; insertionArray[j - 1] &gt; tmp) \t\t\t{ \t\t\t\tinsertionArray[j] = insertionArray[j - 1]; \t\t\t\tj = j - 1; \t\t\t} \t\t\tinsertionArray[j] = tmp; \t\t} \t\tunsigned int end_time = clock(); \/\/ \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \t\tunsigned int search_time = end_time - start_time; \/\/ \u0438\u0441\u043a\u043e\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \t\tstd::cout &lt;&lt; (float)search_time \/ CLOCKS_PER_SEC &lt;&lt; std::endl; \t\treturn (float)search_time \/ CLOCKS_PER_SEC; \t} \tvoid swap(std::vector&lt;T&gt; *v, int n, int m) \t{ \t\tT tmp = (*v)[n]; \t\t(*v)[n] = (*v)[m]; \t\t(*v)[m] = tmp; \t} \tfloat HeapSort() \t{ \t\tstd::cout &lt;&lt; &quot;Time to Heap&gt;&quot; &lt;&lt; std::endl; \t\tunsigned int start_time = clock(); \/\/ \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \t\tint size = heapArray.size(); \t\tfor (int j = 0; j &lt; size; j++) \t\t{ \t\t\tfor (int i = size \/ 2 - 1 - j \/ 2; i &gt; -1; i--) \t\t\t{ \t\t\t\tif (2 * i + 2 &lt;= size - 1 - j) \t\t\t\t{ \t\t\t\t\tif (heapArray[2 * i + 1] &gt; heapArray[2 * i + 2]) \t\t\t\t\t{ \t\t\t\t\t\tif (heapArray[i] &lt; heapArray[2 * i + 1]) \t\t\t\t\t\t{ \t\t\t\t\t\t\tswap(&amp;heapArray, i, 2 * i + 1); \t\t\t\t\t\t} \t\t\t\t\t} \t\t\t\t\telse \t\t\t\t\t\tif (heapArray[i] &lt; heapArray[2 * i + 2]) \t\t\t\t\t\t{ \t\t\t\t\t\t\tswap(&amp;heapArray, i, 2 * i + 2); \t\t\t\t\t\t} \t\t\t\t} \t\t\t\telse \t\t\t\t\tif (2 * i + 1 &lt;= size - 1 - j) \t\t\t\t\t\tif (heapArray[i] &lt; heapArray[2 * i + 1]) \t\t\t\t\t\t\tswap(&amp;heapArray, i, 2 * i + 1); \t\t\t} \t\t\tswap(&amp;heapArray, 0, size - 1 - j); \t\t} \t\tunsigned int end_time = clock(); \/\/ \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \t\tunsigned int search_time = end_time - start_time; \/\/ \u0438\u0441\u043a\u043e\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \t\tstd::cout &lt;&lt; (float)search_time \/ CLOCKS_PER_SEC &lt;&lt; std::endl; \t\treturn (float)search_time \/ CLOCKS_PER_SEC; \t} \tfloat ShakeSort() \t{ \t\tstd::cout &lt;&lt; &quot;Time to Shake&gt;&quot; &lt;&lt; std::endl; \t\tunsigned int start_time = clock(); \/\/ \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \t\tint size = shakeArray.size(); \t\tint left = 0; \t\tint right = size - 1; \t\tdo { \t\t\tfor (int i = left; i &lt; right; i++) { \t\t\t\tif (shakeArray[i] &gt; shakeArray[i + 1]) \t\t\t\t\tswap(&amp;shakeArray,i,i+1); \t\t\t} \t\t\tright--; \t\t\tfor (int i = right; i &gt; left; i--) { \t\t\t\tif (shakeArray[i] &lt; shakeArray[i - 1]) \t\t\t\t\tswap(&amp;shakeArray, i-1, i); \t\t\t} \t\t\tleft++; \t\t} while (left &lt; right); \t\tunsigned int end_time = clock(); \/\/ \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \t\tunsigned int search_time = end_time - start_time; \/\/ \u0438\u0441\u043a\u043e\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \t\tstd::cout &lt;&lt; (float)search_time \/ CLOCKS_PER_SEC &lt;&lt; std::endl; \t\treturn (float)search_time \/ CLOCKS_PER_SEC; \t} \tvoid PrintArray(int num) \t{ \t\tswitch (num) \t\t{ \t\tcase 0: \t\t\tfor (typename std::list&lt;T&gt;::iterator it = arrayList.begin(); it != arrayList.end(); it++) \t\t\t\tstd::cout &lt;&lt; (*it) &lt;&lt; &quot; &quot;; \t\t\tbreak; \t\tcase 1: \t\t\tfor (typename std::vector&lt;T&gt;::iterator it = bubbleArray.begin(); it != bubbleArray.end(); it++) \t\t\t\tstd::cout &lt;&lt; (*it) &lt;&lt; &quot; &quot;; \t\t\tbreak; \t\tcase 2: \t\t\tfor (typename std::vector&lt;T&gt;::iterator it = shakeArray.begin(); it != shakeArray.end(); it++) \t\t\t\tstd::cout &lt;&lt; (*it) &lt;&lt; &quot; &quot;; \t\t\tbreak; \t\tcase 3: \t\t\tfor (typename std::vector&lt;T&gt;::iterator it = heapArray.begin(); it != heapArray.end(); it++) \t\t\t\tstd::cout &lt;&lt; (*it) &lt;&lt; &quot; &quot;; \t\t\tbreak; \t\tcase 4: \t\t\tfor (typename std::vector&lt;T&gt;::iterator it = insertionArray.begin(); it != insertionArray.end(); it++) \t\t\t\tstd::cout &lt;&lt; (*it) &lt;&lt; &quot; &quot;; \t\t\tbreak; \t\tdefault: \t\t\tbreak; \t\t \t\t} \t\tstd::cout &lt;&lt; std::endl; \t} }; <\/code><\/pre>\n<p>  \u0417\u0430\u043c\u0435\u0447\u0443 \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0446\u0435\u043b\u044b\u0435 \u0447\u0438\u0441\u043b\u0430, \u043d\u043e \u0438 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u044b.<\/p>\n<p>  \u0424\u0430\u0439\u043b \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<pre><code class=\"cpp\"> #include &quot;Sorts.h&quot;   int main() { \tstd::vector&lt;float&gt; vq, vb, vs, vh, vi; \tfloat meanq = 0, meanb = 0, means = 0, meanh = 0, meani = 0; \tconst int N = 100; \tsrand(time(0)); \tfor (int i = 0; i &lt; N; i++) \t{ \t\tstd::cout &lt;&lt; i+1 &lt;&lt; &quot; iteration&quot; &lt;&lt; std::endl; \t\tconst int iSize = 1000; \t\tauto sort = new Sorts&lt;int&gt;(); \t\tfor (int i = 0; i &lt; iSize; i++) \t\t{ \t\t\tint num = rand() % iSize; \t\t\tsort-&gt;arrayList.push_back(num); \t\t\tsort-&gt;bubbleArray.push_back(num); \t\t\tsort-&gt;shakeArray.push_back(num); \t\t\tsort-&gt;heapArray.push_back(num); \t\t\tsort-&gt;insertionArray.push_back(num); \t\t}  \t\tstd::cout &lt;&lt; &quot;Time to Quick sort from stl&gt;&quot; &lt;&lt; std::endl; \t\tunsigned int start_time = clock(); \/\/ \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \t\tsort-&gt;arrayList.sort(); \t\tunsigned int end_time = clock(); \/\/ \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \t\tunsigned int search_time = end_time - start_time; \/\/ \u0438\u0441\u043a\u043e\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \t\tstd::cout &lt;&lt; (float)search_time \/ CLOCKS_PER_SEC &lt;&lt; std::endl; \t\tvq.push_back((float)search_time \/ CLOCKS_PER_SEC); \t\tvb.push_back(sort-&gt;BubbleSort()); \t\tvs.push_back(sort-&gt;ShakeSort()); \t\tvh.push_back(sort-&gt;HeapSort()); \t\tvi.push_back(sort-&gt;InsertionSort()); \t\tmeanq += vq[i]; \t\tmeanb += vb[i]; \t\tmeans += vs[i]; \t\tmeanh += vh[i]; \t\tmeani += vi[i]; \t\t\/\/sort-&gt;PrintArray(0); \t\t\/\/sort-&gt;PrintArray(1); \t\t\/\/sort-&gt;PrintArray(2); \t\t\/\/sort-&gt;PrintArray(3); \t\t\/\/sort-&gt;PrintArray(4); \t\tsort-&gt;arrayList.clear(); \t\tsort-&gt;bubbleArray.clear(); \t\tsort-&gt;shakeArray.clear(); \t\tsort-&gt;heapArray.clear(); \t\tsort-&gt;insertionArray.clear(); \t\tstd::cout &lt;&lt; &quot;end of &quot;&lt;&lt; i + 1 &lt;&lt;&quot; iteration&quot; &lt;&lt; std::endl; \t} \tstd::cout &lt;&lt; &quot;Results:&quot; &lt;&lt; std::endl; \tstd::cout &lt;&lt; &quot;Mean quick=&quot; &lt;&lt; (float)meanq \/ N &lt;&lt; std::endl; \tstd::cout &lt;&lt; &quot;Mean bubble=&quot; &lt;&lt; (float)meanb \/ N &lt;&lt; std::endl; \tstd::cout &lt;&lt; &quot;Mean shake=&quot; &lt;&lt; (float)means \/ N  &lt;&lt; std::endl; \tstd::cout &lt;&lt; &quot;Mean heap=&quot; &lt;&lt; (float)meanh \/ N  &lt;&lt; std::endl; \tstd::cout &lt;&lt; &quot;Mean insertion=&quot; &lt;&lt; (float)meani \/ N &lt;&lt; std::endl; \treturn 0; } <\/code><\/pre>\n<p>  \u041a\u0430\u043a\u043e\u0432\u044b \u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b?<\/p>\n<p>  \u0421 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043e\u0442\u0440\u044b\u0432\u043e\u043c \u0438\u0434\u0435\u0442 sort \u0438\u0437 stl, \u043f\u043e\u0442\u043e\u043c \u0432\u0441\u0442\u0430\u0432\u043a\u0430\u043c\u0438, \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u0430\u043b\u044c\u043d\u0430\u044f, \u0448\u0435\u0439\u043a\u0435\u0440\u043d\u0430\u044f \u0438 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442 \u043f\u0443\u0437\u044b\u0440\u044c\u043a\u043e\u0432\u0430\u044f.<\/p>\n<p>  Quick \u2014 0.00225 ms<br \/>  Insertion \u2014 0.04482 ms<br \/>  Heap \u2014 0.07025 ms<br \/>  Shake \u2014 0.14186 ms<br \/>  Bubble \u2014 0.14324 ms<\/p>\n<p>  \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043e\u043b\u0433\u043e \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f, \u043d\u043e quicksort \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u043e\u0440\u044f\u0434\u043a\u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445.<\/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\/541462\/\"> https:\/\/habr.com\/ru\/post\/541462\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0432\u043e\u043f\u0440\u043e\u0441\u0443 \u0443\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0433\u0443\u0433\u043b\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441.<\/p>\n<p>  \u041a\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u044f \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043b \u043f\u0430\u0440\u0443 \u0440\u0430\u0437. \u0412\u0441\u0435\u0433\u0434\u0430 \u0431\u044b\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0434\u0440\u0443\u0433\u043e\u0439. \u0418\u0445 \u043a\u0430\u043a \u0431\u044b \u0432\u0441\u0435 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u044b \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442, \u043d\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u0441\u0435\u0432\u0434\u043e\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043d\u0430 \u043b\u0435\u043a\u0446\u0438\u0438 \u0432 \u043a\u043e\u0434 \u043d\u0430 \u043a\u0430\u043a\u043e\u043c-\u043d\u0438\u0431\u0443\u0434\u044c \u044f\u0437\u044b\u043a\u0435. \u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0434\u043b\u044f \u043a\u0430\u043a\u043e\u0433\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430.<br \/>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c 5 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043e\u043a. \u042d\u0442\u043e \u043f\u0443\u0437\u044b\u0440\u044c\u043a\u043e\u0432\u0430\u044f(bubble), \u0448\u0435\u0439\u043a\u0435\u0440\u043d\u0430\u044f(shake), \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u0430\u043b\u044c\u043d\u0430\u044f(heap), \u0432\u0441\u0442\u0430\u0432\u043a\u0430\u043c\u0438(insertion) \u0438 \u0431\u044b\u0441\u0442\u0440\u0430\u044f(quick).  <\/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-317677","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/317677","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=317677"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/317677\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=317677"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=317677"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=317677"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}