{"id":294025,"date":"2019-08-29T21:00:18","date_gmt":"2019-08-29T21:00:18","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=294025"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=294025","title":{"rendered":"\u0420\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u043a\u0430 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0433\u043b\u0443\u0431\u0438\u043d\u044b"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u043a\u0435 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0439 \u0433\u043b\u0443\u0431\u0438\u043d\u044b. \u042d\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u0430\u043d\u044f\u0442\u0438\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0442\u0443\u0442 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0435\u0441\u0442\u044c, \u0438\u0445 \u043f\u043b\u044e\u0441\u044b \u0438 \u043c\u0438\u043d\u0443\u0441\u044b \u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0438\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  <\/p>\n<p>\u0421\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u043e\u0432 \u043d\u0438\u0436\u0435:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0424\u0443\u043d\u043a\u0446\u0438\u0438<\/li>\n<li>\u0414\u0430\u043d\u043d\u044b\u0435<\/li>\n<li>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b<\/li>\n<li>\u0412\u044b\u0432\u043e\u0434\u044b<\/li>\n<\/ul>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h1 id=\"chast-1-funkcii\">\u0427\u0430\u0441\u0442\u044c 1. \u0424\u0443\u043d\u043a\u0446\u0438\u0438<\/h1>\n<p>  <\/p>\n<h2 id=\"zaimstvovannye-realizacii\">\u0417\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438<\/h2>\n<p>  <\/p>\n<h3 id=\"outer_flatten_1\">outer_flatten_1<\/h3>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def outer_flatten_1(array: Iterable) -&gt; List:     &quot;&quot;&quot;     Based on C realization of this solution     More on:      https:\/\/iteration-utilities.readthedocs.io\/en\/latest\/generated\/deepflatten.html      https:\/\/github.com\/MSeifert04\/iteration_utilities\/blob\/384948b4e82e41de47fa79fb73efc56c08549b01\/src\/deepflatten.c     &quot;&quot;&quot;     return deepflatten(array)<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0414\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u044f \u0432\u0437\u044f\u043b \u0438\u0437 1 \u0438\u0437 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432, iteration_utilities.<\/p>\n<p>  <\/p>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u043d\u0430 \u0421\u0438, \u043e\u0441\u0442\u0430\u0432\u0438\u0432 \u0434\u043b\u044f \u043f\u0438\u0442\u043e\u043d\u0430 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<br \/>  \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430 \u0421\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u043e\u0439, \u043c\u043e\u0436\u0435\u0442\u0435 \u0435\u0451 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043f\u0435\u0440\u0435\u0439\u0434\u044f \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u0432 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u0435. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">&gt;&gt;&gt; from typing import Iterator, Generator &gt;&gt;&gt; from iteration_utilities import deepflatten &gt;&gt;&gt; isinstance(deepflatten(a), Iterator) True &gt;&gt;&gt; isinstance(deepflatten(a), Generator) False<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043b\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0443\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u044d\u0442\u043e\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441 \u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u0445 \u0425\u0430\u0431\u0440\u0430.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0446\u0435\u043b\u043e\u043c, \u0442\u0430\u043a\u0436\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0437 \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u044b\u0435 \u0438 \u0442\u0430\u043a\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u0421\u0438.<\/p>\n<p>  <\/p>\n<h3 id=\"outer_flatten_2\">outer_flatten_2<\/h3>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def outer_flatten_2(array: Iterable) -&gt; List:     &quot;&quot;&quot;     recursive algorithm, vaguely reminiscent of recursion_flatten. Based on next pattern:      .. code:: python          try:             tree = iter(node)         except TypeError:             yield node      more on:     https:\/\/more-itertools.readthedocs.io\/en\/stable\/api.html#more_itertools.collapse     &quot;&quot;&quot;     return collapse(array)<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u043a\u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u043c \u043f\u0430\u043a\u0435\u0442\u0435, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e more_itertools.<br \/>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c \u043f\u0438\u0442\u043e\u043d\u0435, \u043e\u0434\u043d\u0430\u043a\u043e \u043d\u0435\u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 <a href=\"https:\/\/more-itertools.readthedocs.io\/en\/stable\/_modules\/more_itertools\/more.html#collapse\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a> \u043d\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e.<br \/>  \u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 O(n*m).<\/p>\n<p>  <\/p>\n<h2 id=\"sobstvennye-realizacii\">\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438<\/h2>\n<p>  <\/p>\n<h3 id=\"niccolum_flatten\">niccolum_flatten<\/h3>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def niccolum_flatten(array: Iterable) -&gt; List:     &quot;&quot;&quot;     Non recursive algorithm     Based on pop\/insert elements in current list     &quot;&quot;&quot;      new_array = array[:]     ind = 0     while True:         try:             while isinstance(new_array[ind], list):                 item = new_array.pop(ind)                 for inner_item in reversed(item):                     new_array.insert(ind, inner_item)             ind += 1         except IndexError:             break     return new_array<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0442\u043e \u0437\u0430\u0448\u043b\u0430 \u0440\u0435\u0447\u044c \u0432 \u043f\u0430\u0431\u043b\u0438\u043a\u0435 python beginners \u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u0445 \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u043a\u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0439 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u044f \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b \u0441\u0432\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.<\/p>\n<p>  <\/p>\n<p>\u0417\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u043d \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a (\u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0435\u0433\u043e), \u0430 \u0434\u0430\u043b\u0435\u0435 \u0432 \u0446\u0438\u043a\u043b\u0435 while True \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u043f\u043e\u043a\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u2014 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043c\u0441\u044f \u043f\u043e \u043d\u0435\u043c\u0443 \u0438 \u0438\u043d\u0441\u0451\u0440\u0442\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u0441\u0430\u043c\u043e\u0435 \u043d\u0430\u0447\u0430\u043b\u043e.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430, \u0441\u0435\u0439\u0447\u0430\u0441 \u044f \u043f\u043e\u043d\u0438\u043c\u0430\u044e, \u0447\u0442\u043e \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435\u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0438 \u0441\u043b\u043e\u0436\u043d\u043e, \u0442.\u043a. \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0435\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 (\u0442.\u043a. \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0438 \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0438\u0437 \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043f\u0438\u0441\u043a\u0430), \u043e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0442\u043e\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u0430\u0432\u043e \u043d\u0430 \u0436\u0438\u0437\u043d\u044c \u0438 \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 O(n*<em>3<\/em>m) \u0438\u0437 \u0437\u0430 \u043f\u0435\u0440\u0435\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u043f\u0438\u0441\u043a\u0430 \u0434\u0432\u0430\u0436\u0434\u044b \u0437\u0430 \u043a\u0430\u0436\u0434\u0443\u044e \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u043d\u0443\u044e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e<\/p>\n<p>  <\/p>\n<h3 id=\"tishka_flatten\">tishka_flatten<\/h3>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def tishka_flatten(data: Iterable) -&gt; List:     &quot;&quot;&quot;     Non recursive algorithm     Based on append\/extend elements to new list      &quot;&quot;&quot;     nested = True     while nested:         new = []         nested = False         for i in data:             if isinstance(i, list):                 new.extend(i)                 nested = True             else:                 new.append(i)         data = new     return data<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u043f\u0435\u0440\u0432\u044b\u0445 \u0442\u0430\u043a\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u0422\u0438\u0448\u043a\u0430. \u0417\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u043d\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0446\u0438\u043a\u043b\u0430 while nested \u0438\u0434\u0451\u0442 \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u043f\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c\u0443 \u0441\u043f\u0438\u0441\u043a\u0443 \u0441 \u043a\u043b\u044e\u0447\u043e\u043c nested = False, \u0438, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0435\u043c\u0443 \u0445\u043e\u0442\u044f \u0431\u044b \u0440\u0430\u0437 \u043f\u043e\u043f\u0430\u043b\u0441\u044f \u043b\u0438\u0441\u0442, \u043e\u043d \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0444\u043b\u0430\u0433 nested = True \u0438 extend&#8217;\u0438\u0442 \u044d\u0442\u043e\u0442 \u043b\u0438\u0441\u0442 \u0432 \u0441\u043f\u0438\u0441\u043e\u043a. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0437\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0440\u043e\u0433\u043e\u043d \u043e\u043d \u0440\u0430\u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u043e\u0434\u0438\u043d \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u2014 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0431\u0443\u0434\u0435\u0442 \u0438 \u043f\u0440\u043e\u0445\u043e\u0434\u043e\u0432 \u043f\u043e \u0446\u0438\u043a\u043b\u0443. \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u2014 \u043d\u0435 \u0441\u0430\u043c\u044b\u0439 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043d\u043e \u0432\u0441\u0451 \u0436\u0435, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u043c \u043e\u0442 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445.<br \/>  \u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 O(n*m).<\/p>\n<p>  <\/p>\n<h3 id=\"zart_flatten\">zart_flatten<\/h3>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def zart_flatten(a: Iterable) -&gt; List:     &quot;&quot;&quot;     Non recursive algorithm     Based on pop from old and append elements to new list     &quot;&quot;&quot;     queue, out = [a], []     while queue:         elem = queue.pop(-1)         if isinstance(elem, list):             queue.extend(elem)         else:             out.append(elem)     return out[::-1]<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043e\u043f\u044b\u0442\u043d\u044b\u0445 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u0447\u0430\u0442\u0430. \u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0438 \u0447\u0438\u0441\u0442\u044b\u043c. \u0421\u043c\u044b\u0441\u043b \u0435\u0433\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u044d\u0442\u043e \u0441\u043f\u0438\u0441\u043e\u043a, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u043a\u043e\u043d\u0435\u0446 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430, \u0430 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u2014 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0432\u044b\u0432\u043e\u0434. \u0411\u0443\u0434\u0443 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0438\u0436\u0435 extend\/append \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c. \u041a\u0430\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u2014 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043f\u0435\u0440\u0435\u0432\u0451\u0440\u043d\u0443\u0442\u044b\u0439 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043f\u043b\u043e\u0441\u043a\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 O(n*m).<\/p>\n<p>  <\/p>\n<h3 id=\"recursive_flatten_iterator\">recursive_flatten_iterator<\/h3>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def recursive_flatten_iterator(arr: Iterable) -&gt; Iterator:     &quot;&quot;&quot;     Recursive algorithm based on iterator     Usual solution to this problem     &quot;&quot;&quot;      for i in arr:         if isinstance(i, list):             yield from recursion_flatten(i)         else:             yield i<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0441\u0430\u043c\u044b\u0439 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u2014 \u0447\u0435\u0440\u0435\u0437 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u044e \u0438 yield from. \u041c\u0430\u043b\u043e \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0437\u0430\u0430\u0442\u044c \u2014 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c, \u043d\u0435 \u0441\u0447\u0438\u0442\u0430\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043e\u043d \u0441\u0434\u0435\u043b\u0430\u043d \u0447\u0435\u0440\u0435\u0437 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u044e \u0438, \u043f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u0445, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u0442\u044d\u043a \u0432\u044b\u0437\u043e\u0432\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 O(n*m).<\/p>\n<p>  <\/p>\n<h3 id=\"recursive_flatten_generator\">recursive_flatten_generator<\/h3>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def recursive_flatten_generator(array: Iterable) -&gt; List:     &quot;&quot;&quot;     Recursive algorithm     Looks like recursive_flatten_iterator, but with extend\/append      &quot;&quot;&quot;     lst = []     for i in array:         if isinstance(i, list):             lst.extend(recursive_flatten_list(i))         else:             lst.append(i)     return lst<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 \u043f\u0440\u0435\u0440\u044b\u0434\u0443\u0449\u0443\u044e, \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u043d\u0435 \u0447\u0435\u0440\u0435\u0437 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440, \u0430 \u0447\u0435\u0440\u0435\u0437 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0439 extend\/append \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c.<\/p>\n<p>  <\/p>\n<p>\u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 O(n*m).<\/p>\n<p>  <\/p>\n<h3 id=\"tishka_flatten_with_stack\">tishka_flatten_with_stack<\/h3>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def tishka_flatten_with_stack(seq: Iterable) -&gt; List:     &quot;&quot;&quot;     Non recursive algorithm     Based on zart_flatten, but build on try\/except pattern     &quot;&quot;&quot;     stack = [iter(seq)]     new = []     while stack:         i = stack.pop()         try:             while True:                 data = next(i)                 if isinstance(data, list):                     stack.append(i)                     i = iter(data)                 else:                     new.append(data)         except StopIteration:             pass     return new<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0415\u0449\u0451 1 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0422\u0438\u0448\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 zart_flatten, \u043e\u0434\u043d\u0430\u043a\u043e \u0442\u0430\u043c \u0431\u044b\u043b\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 extend\/append \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u0442\u043e \u0442\u0443\u0442 \u2014 \u0447\u0435\u0440\u0435\u0437 \u0438\u0442\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u044d\u0442\u043e\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043d\u0435\u0447\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u043d\u0430 zart_flatten, \u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u0438\u0442\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 while True.<\/p>\n<p>  <\/p>\n<p>\u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 O(n*m).<\/p>\n<p>  <\/p>\n<h1 id=\"chast-2-dannye\">\u0427\u0430\u0441\u0442\u044c 2. \u0414\u0430\u043d\u043d\u044b\u0435<\/h1>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u044d\u0442\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0430\u0432\u0442\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0439 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u0441 \u0447\u0435\u043c \u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u0438 \u043f\u043e\u043a\u0430\u0436\u0443 \u0432\u0430\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0438\u0436\u0435:<\/p>\n<p>  <\/p>\n<h3 id=\"create_data_decreasing_depth\">create_data_decreasing_depth<\/h3>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def create_data_decreasing_depth(         data: Union[List, Iterator],         length: int,         max_depth: int,         _current_depth: int = None,         _result: List = None ) -&gt; List:     &quot;&quot;&quot;     creates data in depth on decreasing.      Examples:      &gt;&gt;&gt; data = create_data_decreasing_depth(list(range(1, 11)), length=5, max_depth=3)     &gt;&gt;&gt; assert data == [[[1, 2, 3, 4, 5], 6, 7, 8, 9, 10]]     &gt;&gt;&gt; data = create_data_decreasing_depth(list(range(1, 11)), length=2, max_depth=3)     &gt;&gt;&gt; assert data == [[[1, 2], 3, 4], 5, 6], [[7, 8,] 9, 10]]     &quot;&quot;&quot;     _result = _result or []     _current_depth = _current_depth or max_depth     data = iter(data)     if _current_depth - 1:         _result.append(create_data_decreasing_depth(             data=data,             length=length,             max_depth=max_depth,             _current_depth=_current_depth - 1,             _result=_result))     try:         _current_length = length         while _current_length:             item = next(data)             _result.append(item)             _current_length -= 1          if max_depth == _current_depth:             _result += create_data_decreasing_depth(                 data=data,                 length=length,                 max_depth=max_depth)         return _result      except StopIteration:         return _result<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0441\u043f\u0438\u0441\u043a\u0438 \u0441 \u0443\u0431\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">    &gt;&gt;&gt; data = create_data_decreasing_depth(list(range(1, 11)), length=5, max_depth=3)     &gt;&gt;&gt; assert data == [[[1, 2, 3, 4, 5], 6, 7, 8, 9, 10]]     &gt;&gt;&gt; data = create_data_decreasing_depth(list(range(1, 11)), length=2, max_depth=3)     &gt;&gt;&gt; assert data == [[[1, 2], 3, 4], 5, 6], [[7, 8,] 9, 10]]<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"create_data_increasing_depth\">create_data_increasing_depth<\/h3>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def create_data_increasing_depth(         data: Union[List, Iterator],         length: int,         max_depth: int,         _current_depth: int = None,         _result: List = None ) -&gt; List:     &quot;&quot;&quot;     creates data in depth to increase.      Examples:      &gt;&gt;&gt; data = create_data_increasing_depth(list(range(1, 11)), length=5, max_depth=3)     &gt;&gt;&gt; assert data == [1, 2, 3, 4, 5, [6, 7, 8, 9, 10]]     &gt;&gt;&gt; data = create_data_increasing_depth(list(range(1, 11)), length=2, max_depth=3)     &gt;&gt;&gt; assert data == [1, 2, [3, 4, [5, 6]]], 7, 8, [9, 10]]     &quot;&quot;&quot;     _result = _result or []     _current_depth = _current_depth or max_depth     data = iter(data)     try:         _current_length = length         while _current_length:             item = next(data)             _result.append(item)             _current_length -= 1      except StopIteration:         return _result      if _current_depth - 1:         tmp_res = create_data_increasing_depth(             data=data,             length=length,             max_depth=max_depth,             _current_depth=_current_depth - 1)         if tmp_res:             _result.append(tmp_res)      if max_depth == _current_depth:         tmp_res = create_data_increasing_depth(             data=data,             length=length,             max_depth=max_depth)         if tmp_res:             _result += tmp_res     return _result<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0441\u043f\u0438\u0441\u043a\u0438 \u0441 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u044e\u0449\u0435\u0439 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">    &gt;&gt;&gt; data = create_data_increasing_depth(list(range(1, 11)), length=5, max_depth=3)     &gt;&gt;&gt; assert data == [1, 2, 3, 4, 5, [6, 7, 8, 9, 10]]     &gt;&gt;&gt; data = create_data_increasing_depth(list(range(1, 11)), length=2, max_depth=3)     &gt;&gt;&gt; assert data == [1, 2, [3, 4, [5, 6]]], 7, 8, [9, 10]]<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"generate_data\">generate_data<\/h3>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def generate_data() -&gt; List[Tuple[str, Dict[str, Union[range, Num]]]]:     &quot;&quot;&quot;     Generated collections of Data by pattern      {amount_item}_amount_{length}_length_{max_depth}_max_depth      where:      .. py:attribute:: amount_item:          len of flatten elements      .. py:attribute:: length:          len of elements at the same level of nesting      .. py:attribute:: max_depth:          highest possible level of nesting     &quot;&quot;&quot;      data = []     amount_of_elements = [10 ** i for i in range(5)]     data_template = '{amount_item}_amount_{length}_length_{max_depth}_max_depth'      # amount_item doesn't need to be [1]     for amount_item in amount_of_elements[1:]:         for max_depth in amount_of_elements:             # for exclude flatten list after generate data by create_data_increasing_depth             if amount_item &gt; max_depth:                 # generate four types of length                 for length in range(0, max_depth + 1, math.ceil(max_depth \/ 4)):                     # min length must be 1                     length = length or 1                      data_name = data_template.format(                         amount_item=amount_item,                         length=length,                         max_depth=max_depth                     )                      data_value = {                         'data': range(amount_item),                         'length': length,                         'max_depth': max_depth                     }                      data.append((data_name, data_value))                      # for not to produce more than 1 flat entity                     if max_depth == 1:                         break      # this order is convenient for me     data = sorted(data, key=lambda x: [x[1]['data'][-1], x[1]['max_depth'], x[1]['length']])     return data<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u043d\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">data_template = '{amount_item}_amount_{length}_length_{max_depth}_max_depth'<\/code><\/pre>\n<p>  <\/p>\n<p>\u0413\u0434\u0435:<\/p>\n<p>  <\/p>\n<ul>\n<li>amount \u2014 \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435<\/li>\n<li>length \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438<\/li>\n<li>max_depth \u2014 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0421\u0430\u043c\u0438 \u0436\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u044b\u0448\u0435 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435, \u043a\u0430\u043a \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u043f\u043e\u0437\u0436\u0435, \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0443\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435(\u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438):<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">10_amount_1_length_1_max_depth 100_amount_1_length_1_max_depth 100_amount_1_length_10_max_depth 100_amount_3_length_10_max_depth 100_amount_6_length_10_max_depth 100_amount_9_length_10_max_depth 1000_amount_1_length_1_max_depth 1000_amount_1_length_10_max_depth 1000_amount_3_length_10_max_depth 1000_amount_6_length_10_max_depth 1000_amount_9_length_10_max_depth 1000_amount_1_length_100_max_depth 1000_amount_25_length_100_max_depth 1000_amount_50_length_100_max_depth 1000_amount_75_length_100_max_depth 1000_amount_100_length_100_max_depth 10000_amount_1_length_1_max_depth 10000_amount_1_length_10_max_depth 10000_amount_3_length_10_max_depth 10000_amount_6_length_10_max_depth 10000_amount_9_length_10_max_depth 10000_amount_1_length_100_max_depth 10000_amount_25_length_100_max_depth 10000_amount_50_length_100_max_depth 10000_amount_75_length_100_max_depth 10000_amount_100_length_100_max_depth 10000_amount_1_length_1000_max_depth 10000_amount_250_length_1000_max_depth 10000_amount_500_length_1000_max_depth 10000_amount_750_length_1000_max_depth 10000_amount_1000_length_1000_max_depth<\/code><\/pre>\n<p>  <\/p>\n<h1 id=\"chast-3-rezultaty\">\u0427\u0430\u0441\u0442\u044c 3. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b<\/h1>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f CPU \u2014 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b line_profiler<br \/>  \u0414\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432 \u2014 timeit + matplotlib<\/p>\n<p>  <\/p>\n<h4 id=\"cpu-profayler\">CPU \u041f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412\u044b\u0432\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"plaintext\">$ kernprof -l funcs.py  $ python -m line_profiler funcs.py.lprof Timer unit: 1e-06 s  Total time: 1.7e-05 s File: funcs.py Function: outer_flatten_1 at line 11  Line #      Hits         Time  Per Hit   % Time  Line Contents ==============================================================     11                                           @profile     12                                           def outer_flatten_1(array: Iterable) -&gt; List:     13                                               &quot;&quot;&quot;     14                                               Based on C realization of this solution     15                                               More on:     16     17                                               https:\/\/iteration-utilities.readthedocs.io\/en\/latest\/generated\/deepflatten.html     18     19                                               https:\/\/github.com\/MSeifert04\/iteration_utilities\/blob\/384948b4e82e41de47fa79fb73efc56c08549b01\/src\/deepflatten.c     20                                               &quot;&quot;&quot;     21         2         17.0      8.5    100.0      return deepflatten(array)  Total time: 3.3e-05 s File: funcs.py Function: outer_flatten_2 at line 24  Line #      Hits         Time  Per Hit   % Time  Line Contents ==============================================================     24                                           @profile     25                                           def outer_flatten_2(array: Iterable) -&gt; List:     26                                               &quot;&quot;&quot;     27                                               recursive algorithm, vaguely reminiscent of recursion_flatten. Based on next pattern:     28     29                                               .. code:: python     30     31                                                   try:     32                                                       tree = iter(node)     33                                                   except TypeError:     34                                                       yield node     35     36                                               more on:     37                                               https:\/\/more-itertools.readthedocs.io\/en\/stable\/api.html#more_itertools.collapse     38                                               &quot;&quot;&quot;     39         2         33.0     16.5    100.0      return collapse(array)  Total time: 0.105099 s File: funcs.py Function: niccolum_flatten at line 42  Line #      Hits         Time  Per Hit   % Time  Line Contents ==============================================================     42                                           @profile     43                                           def niccolum_flatten(array: Iterable) -&gt; List:     44                                               &quot;&quot;&quot;     45                                               Non recursive algorithm     46                                               Based on pop\/insert elements in current list     47                                               &quot;&quot;&quot;     48     49         2         39.0     19.5      0.0      new_array = array[:]     50         2          6.0      3.0      0.0      ind = 0     51         2          2.0      1.0      0.0      while True:     52     20002       7778.0      0.4      7.4          try:     53     21010      13528.0      0.6     12.9              while isinstance(new_array[ind], list):     54      1008       1520.0      1.5      1.4                  item = new_array.pop(ind)     55     21014      13423.0      0.6     12.8                  for inner_item in reversed(item):     56     20006      59375.0      3.0     56.5                      new_array.insert(ind, inner_item)     57     20000       9423.0      0.5      9.0              ind += 1     58         2          2.0      1.0      0.0          except IndexError:     59         2          2.0      1.0      0.0              break     60         2          1.0      0.5      0.0      return new_array  Total time: 0.137481 s File: funcs.py Function: tishka_flatten at line 63  Line #      Hits         Time  Per Hit   % Time  Line Contents ==============================================================     63                                           @profile     64                                           def tishka_flatten(data: Iterable) -&gt; List:     65                                               &quot;&quot;&quot;     66                                               Non recursive algorithm     67                                               Based on append\/extend elements to new list     68     69                                               &quot;&quot;&quot;     70         2         17.0      8.5      0.0      nested = True     71      1012       1044.0      1.0      0.8      while nested:     72      1010       1063.0      1.1      0.8          new = []     73      1010        992.0      1.0      0.7          nested = False     74    112018      38090.0      0.3     27.7          for i in data:     75    111008      50247.0      0.5     36.5              if isinstance(i, list):     76      1008       1431.0      1.4      1.0                  new.extend(i)     77      1008       1138.0      1.1      0.8                  nested = True     78                                                       else:     79    110000      42052.0      0.4     30.6                  new.append(i)     80      1010       1406.0      1.4      1.0          data = new     81         2          1.0      0.5      0.0      return data  Total time: 0.062931 s File: funcs.py Function: zart_flatten at line 84  Line #      Hits         Time  Per Hit   % Time  Line Contents ==============================================================     84                                           @profile     85                                           def zart_flatten(a: Iterable) -&gt; List:     86                                               &quot;&quot;&quot;     87                                               Non recursive algorithm     88                                               Based on pop from old and append elements to new list     89                                               &quot;&quot;&quot;     90         2         20.0     10.0      0.0      queue, out = [a], []     91     21012      12866.0      0.6     20.4      while queue:     92     21010      16849.0      0.8     26.8          elem = queue.pop(-1)     93     21010      17768.0      0.8     28.2          if isinstance(elem, list):     94      1010       1562.0      1.5      2.5              queue.extend(elem)     95                                                   else:     96     20000      13813.0      0.7     21.9              out.append(elem)     97         2         53.0     26.5      0.1      return out[::-1]  Total time: 0.052754 s File: funcs.py Function: recursive_flatten_generator at line 100  Line #      Hits         Time  Per Hit   % Time  Line Contents ==============================================================    100                                           @profile    101                                           def recursive_flatten_generator(array: Iterable) -&gt; List:    102                                               &quot;&quot;&quot;    103                                               Recursive algorithm    104                                               Looks like recursive_flatten_iterator, but with extend\/append    105    106                                               &quot;&quot;&quot;    107      1010       1569.0      1.6      3.0      lst = []    108     22018      13565.0      0.6     25.7      for i in array:    109     21008      17060.0      0.8     32.3          if isinstance(i, list):    110      1008       6624.0      6.6     12.6              lst.extend(recursive_flatten_generator(i))    111                                                   else:    112     20000      13622.0      0.7     25.8              lst.append(i)    113      1010        314.0      0.3      0.6      return lst  Total time: 0.054103 s File: funcs.py Function: recursive_flatten_iterator at line 116  Line #      Hits         Time  Per Hit   % Time  Line Contents ==============================================================    116                                           @profile    117                                           def recursive_flatten_iterator(arr: Iterable) -&gt; Iterator:    118                                               &quot;&quot;&quot;    119                                               Recursive algorithm based on iterator    120                                               Usual solution to this problem    121    122                                               &quot;&quot;&quot;    123    124     22018      20200.0      0.9     37.3      for i in arr:    125     21008      19363.0      0.9     35.8          if isinstance(i, list):    126      1008       6856.0      6.8     12.7              yield from recursive_flatten_iterator(i)    127                                                   else:    128     20000       7684.0      0.4     14.2              yield i  Total time: 0.056111 s File: funcs.py Function: tishka_flatten_with_stack at line 131  Line #      Hits         Time  Per Hit   % Time  Line Contents ==============================================================    131                                           @profile    132                                           def tishka_flatten_with_stack(seq: Iterable) -&gt; List:    133                                               &quot;&quot;&quot;    134                                               Non recursive algorithm    135                                               Based on zart_flatten, but build on try\/except pattern    136                                               &quot;&quot;&quot;    137         2         24.0     12.0      0.0      stack = [iter(seq)]    138         2          5.0      2.5      0.0      new = []    139      1012        357.0      0.4      0.6      while stack:    140      1010        435.0      0.4      0.8          i = stack.pop()    141      1010        328.0      0.3      0.6          try:    142      1010        330.0      0.3      0.6              while True:    143     22018      17272.0      0.8     30.8                  data = next(i)    144     21008      18951.0      0.9     33.8                  if isinstance(data, list):    145      1008        997.0      1.0      1.8                      stack.append(i)    146      1008       1205.0      1.2      2.1                      i = iter(data)    147                                                           else:    148     20000      15413.0      0.8     27.5                      new.append(data)    149      1010        425.0      0.4      0.8          except StopIteration:    150      1010        368.0      0.4      0.7              pass    151         2          1.0      0.5      0.0      return new<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h4 id=\"grafiki\">\u0413\u0440\u0430\u0444\u0438\u043a\u0438<\/h4>\n<p>  <\/p>\n<p>\u041e\u0431\u0449\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mv\/hn\/er\/mvhner8sf4u_w9alvn647vudda0.png\"\/><\/p>\n<p>  <\/p>\n<p>\u0418\u0441\u043a\u043b\u044e\u0447\u0438\u0432 \u0441\u0430\u043c\u044b\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gs\/nm\/pg\/gsnmpgozl3yv02xdzllnuqvlif0.png\"\/><\/p>\n<p>  <\/p>\n<h1 id=\"chast-4-vyvody\">\u0427\u0430\u0441\u0442\u044c 4. \u0412\u044b\u0432\u043e\u0434\u044b<\/h1>\n<p>  <\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0441\u043a\u0430\u0436\u0443 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u0443\u044e \u0432\u0435\u0449\u044c, \u043d\u043e, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0443\u044e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c. \u0422\u0430\u043a, \u0444\u0443\u043d\u043a\u0446\u0438\u044f niccolum_flatten, \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u044b\u043b\u0430 \u0441\u0430\u043c\u0430\u044f \u0432\u044b\u0441\u043e\u043a\u0430\u044f, \u043f\u043e\u043f\u0430\u043b \u0432 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0430\u0434\u0438\u044e \u0438 \u0437\u0430\u043d\u044f\u043b \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u043c\u0435\u0441\u0442\u043e. \u0410 recursive_flatten_generator \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435 recursive_flatten_iterator.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u0432\u043e\u0434\u044f \u0438\u0442\u043e\u0433, \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0443\u0447\u0435\u0431\u043d\u043e\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435, \u043d\u0435\u0436\u0435\u043b\u0438 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043f\u043e \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u043a\u0435 \u0441\u043f\u0438\u0441\u043a\u0430. \u041e\u0431\u044b\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0430\u043c\u0443\u044e \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e, \u043d\u0435 \u0434\u0443\u043c\u0430\u044f, \u0441\u0430\u043c\u0430\u044f \u043b\u0438 \u043e\u043d\u0430 \u0431\u044b\u0441\u0442\u0440\u0430\u044f, \u0442.\u043a. \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f.<\/p>\n<p>  <\/p>\n<h3 id=\"poleznye-ssylki\">\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/h3>\n<p>  <\/p>\n<p>\u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u043b\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/github.com\/Niccolum\/intrst_algrms\/blob\/master\/unpacking_flatten_lists\/results.md\">\u0442\u0443\u0442<\/a><br \/>  \u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 \u043a\u043e\u0434\u043e\u043c <a href=\"https:\/\/github.com\/Niccolum\/intrst_algrms\/\">\u0442\u0443\u0442<\/a><br \/>  \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0447\u0435\u0440\u0435\u0437 sphinx <a href=\"https:\/\/intrst-algrms.readthedocs.io\/en\/latest\/unpacking_flatten_lists.html\">\u0442\u0443\u0442<\/a><\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0430\u0448\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0438, \u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u043c\u0435 <a href=\"https:\/\/habr.com\/ru\/users\/niccolum\/\" class=\"user_link\">Niccolum<\/a> \u0438\u043b\u0438 \u043d\u0430 \u043f\u043e\u0447\u0442\u0443 lastsal@mail.ru.<br \/>  \u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043a\u0440\u0438\u0442\u0438\u043a\u0435.<\/p>\n<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \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\/465531\/\"> https:\/\/habr.com\/ru\/post\/465531\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u043a\u0435 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0439 \u0433\u043b\u0443\u0431\u0438\u043d\u044b. \u042d\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u0430\u043d\u044f\u0442\u0438\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0442\u0443\u0442 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0435\u0441\u0442\u044c, \u0438\u0445 \u043f\u043b\u044e\u0441\u044b \u0438 \u043c\u0438\u043d\u0443\u0441\u044b \u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0438\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  <\/p>\n<p>\u0421\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u043e\u0432 \u043d\u0438\u0436\u0435:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0424\u0443\u043d\u043a\u0446\u0438\u0438<\/li>\n<li>\u0414\u0430\u043d\u043d\u044b\u0435<\/li>\n<li>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b<\/li>\n<li>\u0412\u044b\u0432\u043e\u0434\u044b<\/li>\n<\/ul>\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-294025","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/294025","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=294025"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/294025\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=294025"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=294025"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=294025"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}