{"id":210296,"date":"2014-02-22T11:39:03","date_gmt":"2014-02-22T07:39:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=210296"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=210296","title":{"rendered":"<span class=\"post_title\">Splay-\u0434\u0435\u0440\u0435\u0432\u044c\u044f<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0421\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u043e\u043c \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432. \u041d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u0445 \u043a\u043d\u0438\u0433 \u043f\u043e Computer Science \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u0440\u0430\u0441\u043d\u043e-\u0447\u0435\u0440\u043d\u044b\u0445, AVL-, B- \u0438 \u043c\u043d\u043e\u0433\u0438\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432. \u041d\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u043f\u0435\u0440\u043c\u0430\u043d\u0435\u043d\u0442\u043d\u0430\u044f \u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u044c \u0442\u0435\u043c \u0421\u0432\u044f\u0442\u044b\u043c \u0413\u0440\u0430\u0430\u043b\u0435\u043c, \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0433\u043e\u043d\u044f\u0442\u044c\u0441\u044f?<\/p>\n<p>  \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0443\u0436\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u0434\u0435\u0440\u0435\u0432\u043e \u043d\u0430 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/c7f\/092\/d48\/c7f092d481acb49c8a0f96178ceb3119.gif\"\/> \u043a\u043b\u044e\u0447\u0430\u0445 \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043b\u0435\u0436\u0438\u0442 \u043b\u0438 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0432 \u0434\u0435\u0440\u0435\u0432\u0435. \u041c\u043e\u0436\u0435\u0442 \u0442\u0430\u043a \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043e\u0434\u0438\u043d \u043a\u043b\u044e\u0447, \u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u043d \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0415\u0441\u043b\u0438 \u043a\u043b\u044e\u0447 \u043b\u0435\u0436\u0438\u0442 \u0434\u0430\u043b\u0435\u043a\u043e \u043e\u0442 \u043a\u043e\u0440\u043d\u044f, \u0442\u043e <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/601\/5f7\/e7e\/6015f7e7e19971bf1372e01171eaadcb.gif\"\/> \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043d\u044f\u0442\u044c <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/076\/63d\/c3c\/07663dc3c790b8c5e111597f71b68abc.gif\"\/> \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0417\u0434\u0440\u0430\u0432\u044b\u0439 \u0441\u043c\u044b\u0441\u043b \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u043e\u0446\u0435\u043d\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/7be\/274\/948\/7be27494810106e7a26b615c21f37527.gif\"\/>, \u043d\u0430\u0434\u0441\u0442\u0440\u043e\u0438\u0432 \u043d\u0430\u0434 \u0434\u0435\u0440\u0435\u0432\u043e\u043c \u043a\u044d\u0448. \u041d\u043e \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438 \u0438 \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e splay-\u0434\u0435\u0440\u0435\u0432\u044c\u044f\u0445. \u042d\u0442\u0438 \u0434\u0435\u0440\u0435\u0432\u044c\u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0435\u0440\u043c\u0430\u043d\u0435\u043d\u0442\u043d\u043e \u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u0430\u0436\u0435 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u041e\u0434\u043d\u0430\u043a\u043e, \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043e\u043d\u0438 \u043c\u0435\u043d\u044f\u044e\u0442 \u0441\u0432\u043e\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u044b. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0430\u043c\u043e\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0443 \u043d\u0438\u0445 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/84c\/07b\/cc9\/84c07bcc99d5fc8ab9086ace521ed96a.gif\"\/>, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 splay-\u0434\u0435\u0440\u0435\u0432\u044c\u044f \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043e\u0439 \u0434\u043b\u044f \u043f\u0435\u0440\u043c\u0430\u043d\u0435\u043d\u0442\u043d\u043e \u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u0431\u0440\u0430\u0442\u044c\u0435\u0432.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>Splay-\u0434\u0435\u0440\u0435\u0432\u044c\u044f<\/h4>\n<p>  \u0412 \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435 \u0432\u043e\u0441\u044c\u043c\u0438\u0434\u0435\u0441\u044f\u0442\u044b\u0445 \u0420\u043e\u0431\u0435\u0440\u0442 \u0422\u0430\u0440\u044c\u044f\u043d \u0438 \u0414\u0430\u043d\u0438\u0435\u043b\u044c \u0421\u043b\u0435\u0439\u0442\u043e\u0440 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0445 \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412\u0441\u0435 \u043e\u043d\u0438 \u0438\u043c\u0435\u044e\u0442 \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u0443\u044e \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438 \u043e\u0434\u043d\u0443-\u0434\u0432\u0435 \u044d\u0432\u0440\u0438\u0441\u0442\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0445 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442. Splay-\u0434\u0435\u0440\u0435\u0432\u043e \u2014 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0442\u0430\u043a\u0438\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440.<\/p>\n<p>  Splay-\u0434\u0435\u0440\u0435\u0432\u043e \u2014 \u044d\u0442\u043e \u0441\u0430\u043c\u043e\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u0443\u044e\u0449\u0435\u0435\u0441\u044f \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u043f\u043e\u0438\u0441\u043a\u0430. \u0414\u0435\u0440\u0435\u0432\u0443 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0433\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u043f\u043e \u043f\u0430\u043c\u044f\u0442\u0438. \u041f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f, \u0434\u0430\u0436\u0435 \u043f\u043e\u0438\u0441\u043a\u0430, splay-\u0434\u0435\u0440\u0435\u0432\u043e \u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u0432\u043e\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443. <\/p>\n<p>  \u041d\u0438\u0436\u0435 \u044f \u043e\u043f\u0438\u0448\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u0435\u0440\u0435\u0432\u043e \u043d\u0430 \u043d\u0430\u0431\u043e\u0440\u0435 \u043f\u043e\u043f\u0430\u0440\u043d\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439, \u0430 \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0435\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437. <\/p>\n<h4>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c<\/h4>\n<p>  \u0414\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0435\u0440\u0435\u0432\u0430 \u043d\u0430\u043c \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0432\u0435\u0440\u0448\u0438\u043d\u0443,<\/p>\n<pre><code class=\"python\">class Node:   def __init__(self, key, left = None, right = None, parent = None):     self.left   = left     self.right  = right     self.parent = parent     self.key    = key <\/code><\/pre>\n<p>  \u0438 \u0434\u0432\u0435 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u043d\u0430 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u0439.<\/p>\n<pre><code class=\"python\">def set_parent(child, parent):   if child != None:     child.parent = parent  def keep_parent(v):   set_parent(v.left, v)   set_parent(v.right, v) <\/code><\/pre>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u044d\u0432\u0440\u0438\u0441\u0442\u0438\u043a\u0430 splay-\u0434\u0435\u0440\u0435\u0432\u0430 \u2014 move-to-root. \u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u043b\u044e\u0431\u043e\u0439 \u0432\u0435\u0440\u0448\u0438\u043d\u0435, \u043e\u043d\u0430 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u0440\u0435\u043d\u044c. \u041f\u043e\u0434\u044a\u0435\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u044b \u0432\u0435\u0440\u0448\u0438\u043d. \u0417\u0430 \u043e\u0434\u0438\u043d \u043f\u043e\u0432\u043e\u0440\u043e\u0442, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u043c\u0435\u0441\u0442\u0430\u043c\u0438 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0441 \u0440\u0435\u0431\u0435\u043d\u043a\u043e\u043c, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u043d\u0438\u0436\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/58b\/97d\/c8b\/58b97dc8bf8293538e48a34716f4e1f5.png\"\/><\/p>\n<pre><code class=\"python\">def rotate(parent, child):   gparent = parent.parent   if gparent != None:     if gparent.left == parent:       gparent.left = child     else:       gparent.right = child    if parent.left == child:     parent.left, child.right = child.right, parent   else:     parent.right, child.left = child.left, parent    keep_parent(child)   keep_parent(parent)   child.parent = gparent <\/code><\/pre>\n<p>  \u041d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u0432\u0435\u0440\u0448\u0438\u043d\u0443, \u043f\u043e\u043a\u0430 \u043e\u043d\u0430 \u043d\u0435 \u0441\u0442\u0430\u043d\u0435\u0442 \u043a\u043e\u0440\u043d\u0435\u043c, \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u0425\u0438\u0442\u0440\u043e\u0441\u0442\u044c splay-\u0434\u0435\u0440\u0435\u0432\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u0438 \u043f\u0440\u043e\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0438 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0432\u0432\u0435\u0440\u0445, \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u043e \u043a\u043e\u0440\u043d\u044f \u0441\u043e\u043a\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u043c\u043e\u0439 \u0432\u0435\u0440\u0448\u0438\u043d\u044b, \u043d\u043e \u0438 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0435\u0435 \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432 \u0432 \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u044c\u044f\u0445. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0435\u0445\u043d\u0438\u043a\u0430 zig-zig \u0438 zig-zag \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u043e\u0432.<\/p>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0438\u0434\u0435\u044f zig-zig \u0438 zig-zag \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u043e\u0432, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u0443\u0442\u044c \u043e\u0442 \u0434\u0435\u0434\u0443\u0448\u043a\u0438 \u043a \u0440\u0435\u0431\u0435\u043d\u043a\u0443. \u0415\u0441\u043b\u0438 \u043f\u0443\u0442\u044c \u0438\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u043b\u0435\u0432\u044b\u043c \u0434\u0435\u0442\u044f\u043c \u0438\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u043f\u0440\u0430\u0432\u044b\u043c, \u0442\u043e \u0442\u0430\u043a\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f zig-zig. \u041a\u0430\u043a \u0435\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u043d\u0438\u0436\u0435. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f, \u043f\u043e\u0442\u043e\u043c \u0440\u0435\u0431\u0435\u043d\u043a\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/13c\/2ec\/397\/13c2ec39790be792f792fe393db53be5.png\"\/><\/p>\n<p>  \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043c\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u0435\u043d\u044f\u0435\u043c \u0440\u0435\u0431\u0435\u043d\u043a\u0430 \u0441 \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u043c, \u043f\u043e\u0442\u043e\u043c \u0441 \u043d\u043e\u0432\u044b\u043c.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/ccf\/9f3\/f52\/ccf9f3f52fea0caa23df9070d4833bc3.png\"\/><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0443 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0434\u0435\u0434\u0443\u0448\u043a\u0438 \u043d\u0435\u0442, \u0434\u0435\u043b\u0430\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043f\u043e\u0432\u043e\u0440\u043e\u0442:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/36e\/527\/090\/36e527090c0e49bf48ba45d20fb780f7.png\"\/><\/p>\n<p>  \u041e\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u0432\u044b\u0448\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u043f\u043e\u0434\u043d\u044f\u0442\u0438\u044f \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e zig-zig \u0438 zig-zag \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u043e\u0432 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0434\u043b\u044f splay-\u0434\u0435\u0440\u0435\u0432\u0430.<\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/b>. \u0412 \u0440\u0443\u0441\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u0442\u0435\u0440\u043c\u0438\u043d \u00absplay\u00bb \u043f\u0435\u0440\u0435\u0432\u0435\u043b\u0438 \u043a\u0430\u043a \u00ab\u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c\u00bb. \u041c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u044d\u0442\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u0430\u0447\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0432\u043e\u0434. \u0412\u044b \u0431\u0435\u0440\u0435\u0442\u0435 \u0432\u0435\u0440\u0448\u0438\u043d\u0443 \u0438 \u0442\u044f\u043d\u0435\u0442\u0435 \u0435\u0435 \u043d\u0430\u0432\u0435\u0440\u0445. \u0412 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u0441\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0443\u0445\u043e\u0434\u044f\u0442 \u0432\u043d\u0438\u0437, \u043f\u043e\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u044f\u0441\u044c \u0432\u043e\u043a\u0440\u0443\u0433 \u043d\u0435\u0435. \u041d\u0435\u0447\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0432\u044b\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442\u0435 \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0443. \u0422\u0430\u043a \u0447\u0442\u043e \u0441\u043b\u043e\u0432\u043e \u00ab\u0432\u044b\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c\u00bb \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0437\u0434\u0435\u0441\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u043c.<\/p>\n<pre><code class=\"python\">def splay(v):   if v.parent == None:     return v   parent = v.parent   gparent = parent.parent   if gparent == None:     rotate(parent, v)      return v       else:     zigzig = (gparent.left == parent) == (parent.left == v)     if zigzig:       rotate(gparent, parent)       rotate(parent, v)     else:       rotate(parent, v)       rotate(gparent, v)     return splay(v) <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u043f\u043e\u0438\u0441\u043a\u0430 \u0432 splay-\u0434\u0435\u0440\u0435\u0432\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0441\u0442\u0430\u0434\u0438\u0438: \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u0435\u0440\u0448\u0438\u043d\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u0430, \u043c\u044b \u0442\u044f\u043d\u0435\u043c \u0435\u0435 \u0432\u0432\u0435\u0440\u0445 \u0438 \u0434\u0435\u043b\u0430\u0435\u043c \u043a\u043e\u0440\u043d\u0435\u043c \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 <code>splay<\/code>.<\/p>\n<pre><code class=\"python\">def find(v, key):   if v == None:     return None   if key == v.key:     return splay(v)   if key &lt; v.key and v.left != None:     return find(v.left, key)   if key &gt; v.key and v.right != None:     return find(v.right, key)   return splay(v) <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0442\u0430\u0432\u043a\u0443 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0430, \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u0434\u0432\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b: <code>split<\/code> \u0438 <code>merge<\/code> (\u0440\u0430\u0437\u0440\u0435\u0437\u0430\u0442\u044c \u0438 \u0441\u043b\u0438\u0442\u044c). <\/p>\n<p>  \u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 <code>split<\/code> \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043a\u043b\u044e\u0447 <code>key<\/code> \u0438 \u0434\u0435\u043b\u0438\u0442 \u0434\u0435\u0440\u0435\u0432\u043e \u043d\u0430 \u0434\u0432\u0430. \u0412 \u043e\u0434\u043d\u043e\u043c \u0434\u0435\u0440\u0435\u0432\u0435 \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u0435\u043d\u044c\u0448\u0435 \u043a\u043b\u044e\u0447\u0430 <code>key<\/code>, \u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u2014 \u0431\u043e\u043b\u044c\u0448\u0435. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e. \u041d\u0443\u0436\u043d\u043e \u0447\u0435\u0440\u0435\u0437 <code>find<\/code> \u043d\u0430\u0439\u0442\u0438 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0443\u044e \u043a \u043a\u043b\u044e\u0447\u0443 \u0432\u0435\u0440\u0448\u0438\u043d\u0443, \u0432\u044b\u0442\u044f\u043d\u0443\u0442\u044c \u0435\u0435 \u0432\u0432\u0435\u0440\u0445 \u0438 \u043f\u043e\u0442\u043e\u043c \u043e\u0442\u0440\u0435\u0437\u0430\u0442\u044c \u043b\u0438\u0431\u043e \u043b\u0435\u0432\u043e\u0435, \u043b\u0438\u0431\u043e \u043f\u0440\u0430\u0432\u043e\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u043e (\u043b\u0438\u0431\u043e \u043e\u0431\u0430).<\/p>\n<pre><code class=\"python\">def split(root, key):   if root == None:     return None, None   root = find(root, key)   if root.key == key:     set_parent(root.left, None)     set_parent(root.right, None)     return root.left, root.right   if root.key &lt; key:     right, root.right = root.right, None     set_parent(right, None)     return root, right   else:     left, root.left = root.left, None     set_parent(left, None)     return left, root  <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u043a\u043b\u044e\u0447, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>split<\/code> \u043f\u043e \u043d\u0435\u043c\u0443, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0432\u0435\u0440\u0448\u0438\u043d\u0443-\u043a\u043e\u0440\u0435\u043d\u044c, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u044c\u044f\u043c\u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 <code>split<\/code>-\u0430.  <\/p>\n<pre><code class=\"python\">def insert(root, key):   left, right = split(root, key)   root = Node(key, left, right)   keep_parent(root)   return root <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 <code>merge<\/code> \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0434\u0432\u0430 \u0434\u0435\u0440\u0435\u0432\u0430: \u043b\u0435\u0432\u043e\u0435 <code>left<\/code> \u0438 \u043f\u0440\u0430\u0432\u043e\u0435 <code>right<\/code>. \u0414\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b, \u043a\u043b\u044e\u0447\u0438 \u0434\u0435\u0440\u0435\u0432\u0430 <code>left<\/code> \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043c\u0435\u043d\u044c\u0448\u0435 \u043a\u043b\u044e\u0447\u0435\u0439 \u0434\u0435\u0440\u0435\u0432\u0430 <code>right<\/code>. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0431\u0435\u0440\u0435\u043c \u0432\u0435\u0440\u0448\u0438\u043d\u0443 \u0441 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u043c \u043a\u043b\u044e\u0447\u043e\u043c \u043f\u0440\u0430\u0432\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430 <code>right<\/code> \u0438 \u0442\u044f\u043d\u0435\u043c \u0435\u0435 \u0432\u0432\u0435\u0440\u0445. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043b\u0435\u0432\u043e\u0433\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u0430 \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0434\u0435\u0440\u0435\u0432\u043e <code>left<\/code>.<\/p>\n<pre><code class=\"python\">def merge(left, right):   if right == None:     return left   if left == None:     return right   right = find(right, left.key)   right.left, left.parent = left, right   return right <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0435\u0440\u0448\u0438\u043d\u0443, \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u0435\u0435 \u0432\u0432\u0435\u0440\u0445, \u0430 \u043f\u043e\u0442\u043e\u043c \u0441\u043b\u0438\u0442\u044c \u0435\u0435 \u043b\u0435\u0432\u044b\u0435 \u0438 \u043f\u0440\u0430\u0432\u044b\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u044c\u044f.<\/p>\n<pre><code class=\"python\">def remove(root, key):   root = find(root, key)   set_parent(root.left, None)   set_parent(root.right, None)   return merge(root.left, root.right) <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b splay-\u0434\u0435\u0440\u0435\u0432\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043b\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u043a\u043b\u044e\u0447\u0438, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u0434\u0432\u0443\u043c\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438. \u041d\u0443\u0436\u043d\u043e \u043b\u0438\u0431\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043a\u043b\u044e\u0447\u0443 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0439 \u043d\u0443\u0436\u043d\u0443\u044e \u0434\u043e\u043f. \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043b\u0438\u0431\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 find \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b\u0430 \u043f\u0435\u0440\u0432\u0443\u044e \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u043e\u0431\u0445\u043e\u0434\u0430 LUR \u0432\u0435\u0440\u0448\u0438\u043d\u0443 \u0441 \u043a\u043b\u044e\u0447\u043e\u043c, \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043b\u0438\u0431\u043e \u0440\u0430\u0432\u043d\u044b\u043c \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e.<\/p>\n<h4>\u0410\u043d\u0430\u043b\u0438\u0437<\/h4>\n<p>  \u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f, \u0432\u0441\u0442\u0430\u0432\u043a\u0438, \u0441\u043b\u0438\u044f\u043d\u0438\u044f \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0437\u0430 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/ec7\/176\/ecf\/ec7176ecffb2f187d5ef0d0d24ffdbd4.gif\"\/> + \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b <code>find<\/code>.<\/p>\n<p>  \u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 <code>find<\/code> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u0433\u043b\u0443\u0431\u0438\u043d\u0435 \u0438\u0441\u043a\u043e\u043c\u043e\u0439 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0432 \u0434\u0435\u0440\u0435\u0432\u0435. \u041f\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u043f\u043e\u0438\u0441\u043a\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 <code>splay<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0442\u043e\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u0433\u043b\u0443\u0431\u0438\u043d\u0435 \u0432\u0435\u0440\u0448\u0438\u043d\u044b. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b <code>splay<\/code>.<\/p>\n<p>  \u0414\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0444\u0438\u0437\u0438\u043a\u0430, \u043f\u0440\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u0440\u043e <a href=\"http:\/\/habrahabr.ru\/post\/208624\">\u0430\u043c\u043e\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437<\/a>. \u041f\u0443\u0441\u0442\u044c <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/2c4\/55f\/6c3\/2c455f6c331507d8415d138c126d5cd1.gif\"\/> \u2014 \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u0430 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/801\/e91\/678\/801e916781182638bdd30f434f6dd79f.gif\"\/> \u0441 \u043a\u043e\u0440\u043d\u0435\u043c \u0432 \u0432\u0435\u0440\u0448\u0438\u043d\u0435 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/778\/167\/ba0\/778167ba0bfe8d797c1444241533f806.gif\"\/>. \u0420\u0430\u043d\u0433\u043e\u043c \u0432\u0435\u0440\u0448\u0438\u043d\u044b <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/778\/167\/ba0\/778167ba0bfe8d797c1444241533f806.gif\"\/> \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/2a4\/a15\/263\/2a4a15263185920396d9b74a66fda10e.gif\"\/>. \u041d\u0430\u0448 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b \u0431\u0443\u0434\u0435\u0442 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/01e\/fed\/dbf\/01efeddbf29cf53eddad0eb121c3865c.gif\"\/>.<\/p>\n<p>  \u0411\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b <code>splay(v)<\/code> \u0440\u0430\u0432\u043d\u043e \u0433\u043b\u0443\u0431\u0438\u043d\u0435 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/a89\/b59\/544\/a89b59544c2bf004dcd81c65b5eff160.gif\"\/> \u0432\u0435\u0440\u0448\u0438\u043d\u044b <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/a89\/b59\/544\/a89b59544c2bf004dcd81c65b5eff160.gif\"\/>. \u041e\u0442\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0432\u043d\u043e \u0447\u0438\u0441\u043b\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0440\u043d\u044b\u0445 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u0432 \u0445\u043e\u0434\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b.<\/p>\n<p>  <b>\u0423\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435<\/b>. \u0410\u043c\u043e\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 <code>splay<\/code> \u043e\u0442 \u0432\u0435\u0440\u0448\u0438\u043d\u044b <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/778\/167\/ba0\/778167ba0bfe8d797c1444241533f806.gif\"\/> \u0432 \u0434\u0435\u0440\u0435\u0432\u0435 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/b94\/550\/354\/b94550354872977b0f0aad8cda86789e.gif\"\/> \u0441 \u043a\u043e\u0440\u043d\u0435\u043c <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/ad2\/d15\/a8d\/ad2d15a8df39e0b455d90f44a350d356.gif\"\/> \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/bac\/598\/191\/bac5981912a4b3785f398a37163010ec.gif\"\/>.<\/p>\n<p>  <b>\u0414\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e<\/b>. <br \/>  \u0415\u0441\u043b\u0438 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/778\/167\/ba0\/778167ba0bfe8d797c1444241533f806.gif\"\/> \u2014 \u043a\u043e\u0440\u0435\u043d\u044c, \u0442\u043e \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e. \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 <code>splay(v)<\/code> \u043d\u0430 \u044d\u0442\u0430\u043f\u044b. \u0412 \u0445\u043e\u0434\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u0442\u0430\u043f\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0438\u0437 \u0442\u0440\u0435\u0445 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u043e\u0432: zig, zig-zig \u0438\u043b\u0438 zig-zag. \u041d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u043e\u0432\u043e\u0440\u043e\u0442 \u0443\u0445\u043e\u0434\u0438\u0442 \u0435\u0434\u0438\u043d\u0438\u0446\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043d\u0430 zig-zig \u0438 zig-zag \u2014 \u0434\u0432\u0435 \u0435\u0434\u0438\u043d\u0438\u0446\u044b.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u0442\u0430\u043f\u0430 \u0440\u0430\u043d\u0433 \u0432\u0435\u0440\u0448\u0438\u043d\u044b <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/778\/167\/ba0\/778167ba0bfe8d797c1444241533f806.gif\"\/> \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f. \u041f\u0443\u0441\u0442\u044c \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u043d\u0433 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/bd2\/e8c\/4de\/bd2e8c4deee380873258074067f47a79.gif\"\/>, \u0430 \u043f\u043e\u0441\u043b\u0435 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/882\/839\/fd0\/882839fd0d8c0796ef0f881d89ac3705.gif\"\/>-\u043e\u0433\u043e \u044d\u0442\u0430\u043f\u0430 \u2014 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/45a\/141\/2de\/45a1412deeddf95d0291a61419916399.gif\"\/>. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u0442\u0430\u043f\u0430, \u043a\u0440\u043e\u043c\u0435, \u0431\u044b\u0442\u044c \u043c\u043e\u0436\u0435\u0442, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e, \u043c\u044b \u043f\u043e\u043a\u0430\u0436\u0435\u043c, \u0447\u0442\u043e \u0430\u043c\u043e\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0435\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u0441\u0432\u0435\u0440\u0445\u0443 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u043e\u0439 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/514\/7e6\/520\/5147e652057fc82f5cc918ad29f95543.gif\"\/>. \u0414\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u044d\u0442\u0430\u043f\u0430 \u0432\u0435\u0440\u0445\u043d\u044f\u044f \u043e\u0446\u0435\u043d\u043a\u0430 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/3a7\/c5a\/d43\/3a7c5ad43334e60bfd005218c4a6cf67.gif\"\/>. \u041f\u0440\u043e\u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0432 \u0432\u0435\u0440\u0445\u043d\u0438\u0435 \u043e\u0446\u0435\u043d\u043a\u0438 \u0438 \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0432 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u043d\u0433\u043e\u0432 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u043e\u0435<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/72d\/3e4\/837\/72d3e4837c9cbdce557c78e41a136e51.gif\"\/><\/div>\n<p>  \u041d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/3d4\/903\/c4a\/3d4903c4a6ab562fa149407b12cbdd95.gif\"\/>, \u0430 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/a10\/2e6\/672\/a102e6672264a72c4d01f4c1ef352345.gif\"\/>.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0438\u043f \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>  Zig. \u041c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437, \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u044d\u0442\u0430\u043f\u0435. \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0432\u0440\u0435\u043c\u044f <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/26f\/ff1\/377\/26fff1377fd5ee7a18d590a322203e05.gif\"\/>. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043e\u043a \u0438 \u043f\u043e\u0439\u043c\u0435\u043c, \u0447\u0442\u043e \u0440\u0430\u043d\u0433\u0438 \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0443 \u0432\u0435\u0440\u0448\u0438\u043d <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/778\/167\/ba0\/778167ba0bfe8d797c1444241533f806.gif\"\/> \u0438 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/ad2\/d15\/a8d\/ad2d15a8df39e0b455d90f44a350d356.gif\"\/>.<\/p>\n<p>  <img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/bd9\/d53\/7e5\/bd9d537e58a24dfb94445b704a903153.png\"\/><\/p>\n<p>  \u0417\u043d\u0430\u0447\u0438\u0442, \u0430\u043c\u043e\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/e61\/061\/e90\/e61061e90cf933cf6ec28f8d25e905d7.gif\"\/>. \u0420\u0430\u043d\u0433\u0438 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/155\/bde\/9f5\/155bde9f50a1332adbefa9c833ae068f.gif\"\/> \u0438 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/ad2\/d15\/a8d\/ad2d15a8df39e0b455d90f44a350d356.gif\"\/> \u0441\u043e\u043a\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f. \u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043a \u0444\u043e\u0440\u043c\u0443\u043b\u0435 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/270\/cbb\/bb6\/270cbbbb6cb0b4c0634e86f443bd3ab6.gif\"\/> \u043d\u0435\u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/0ca\/37d\/0b1\/0ca37d0b18e353c266d5b324d89a156f.gif\"\/><\/div>\n<p>  \u0417\u043d\u0430\u0447\u0438\u0442, <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/e8e\/aea\/72f\/e8eaea72f1417fc4e5e0d7a0cc887ef1.gif\"\/>.<\/p>\n<p>  Zig-zig. \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0432\u0440\u0435\u043c\u044f <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/95c\/007\/330\/95c0073302d8e83f0658373bf031d628.gif\"\/>. \u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0440\u0430\u043d\u0433\u0438 \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0443 \u0432\u0435\u0440\u0448\u0438\u043d <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/778\/167\/ba0\/778167ba0bfe8d797c1444241533f806.gif\"\/>, <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/4f9\/ca1\/b1c\/4f9ca1b1c8029535c88032fbe0b24b60.gif\"\/> \u0438 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/8ca\/ebe\/078\/8caebe078b8f5a33590e85caea5439cd.gif\"\/>.<\/p>\n<p>  <img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/566\/742\/2e5\/5667422e5f6a4b17b1936349921a2a62.png\"\/><\/p>\n<p>  \u0422\u043e\u0433\u0434\u0430 \u0430\u043c\u043e\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/f88\/07b\/f37\/f8807bf37fe6b7b3233fef522b691a4a.gif\"\/>. \u0420\u0430\u043d\u0433\u0438 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/155\/bde\/9f5\/155bde9f50a1332adbefa9c833ae068f.gif\"\/> \u0438 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/8ca\/ebe\/078\/8caebe078b8f5a33590e85caea5439cd.gif\"\/> \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c. \u041f\u043e\u043b\u0443\u0447\u0438\u043c, \u0447\u0442\u043e <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/9e6\/f72\/cc4\/9e6f72cc4496cad479eee6dfb081b61c.gif\"\/>. \u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043a \u0444\u043e\u0440\u043c\u0443\u043b\u0435 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/270\/cbb\/bb6\/270cbbbb6cb0b4c0634e86f443bd3ab6.gif\"\/> \u0434\u0432\u0430 \u043d\u0435\u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0430:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/008\/61a\/f75\/00861af757b1c0f16fdd2a82525d278e.gif\"\/><\/div>\n<p>  \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043c, \u0447\u0442\u043e <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/e75\/31c\/f9f\/e7531cf9f42d16323412064c7f4f5fe6.gif\"\/>.<\/p>\n<p>  \u041d\u0430\u0448\u0430 \u0446\u0435\u043b\u044c \u2014 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/d52\/059\/7a0\/d520597a0b03a29b8c707e8c848c0c3c.gif\"\/>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/109\/c83\/64e\/109c8364e518a492c66ea5f67c8b8cfd.gif\"\/>:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/7a0\/5a0\/a12\/7a05a0a12a0fbe9f01d5f5f5df98cac4.gif\"\/><\/div>\n<p>  \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043c \u0440\u0430\u043d\u0433\u0438 \u0432 \u043b\u0435\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0438 \u0431\u0443\u0434\u0435\u043c \u0434\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/b72\/32a\/1c5\/b7232a1c55bfd1af1f3acc2c9b96da7a.gif\"\/>. \u041f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e \u0440\u0430\u043d\u0433\u0430 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/c5a\/8a5\/dcb\/c5a8a5dcb2fd4ca7ee6d1cc05d155a2b.gif\"\/>. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u043e\u0431\u044a\u0435\u043c \u043d\u0430 \u0441\u0443\u043c\u043c\u0443 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/870\/fc4\/a4b\/870fc4a4b5e4ca8541cc7dc7f8103870.gif\"\/>. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043e\u043a \u0438 \u043f\u043e\u0439\u043c\u0435\u043c, \u0447\u0442\u043e <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/83f\/b85\/844\/83fb85844f2166252c48f172a1e0e68c.gif\"\/>.<\/p>\n<p>  <b>\u0424\u0430\u043a\u0442<\/b>. <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/cb8\/e8e\/c07\/cb8e8ec07a4a7872b6acaf707d6e673f.gif\"\/> \u0434\u043b\u044f \u043b\u044e\u0431\u044b\u0445 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/c80\/d13\/d58\/c80d13d587a00fca58b429e785e3c06a.gif\"\/> \u0442\u0430\u043a\u0438\u0445, \u0447\u0442\u043e <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/76b\/3b1\/ea4\/76b3b1ea4f0c87f8fc93e7f66faf333b.gif\"\/>.<\/p>\n<p>  \u0417\u043d\u0430\u0447\u0438\u0442, <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/b5b\/c64\/16d\/b5bc6416de38e399df9e33a337c2d661.gif\"\/>. \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u043e\u0435.<\/p>\n<p>  Zig-zag. <\/p>\n<p>  <img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/fd0\/b05\/323\/fd0b0532300a4e98b6089883319524c8.png\"\/><\/p>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c\u0443 \u0441\u043b\u0443\u0447\u0430\u044e \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0430\u043c\u043e\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u043e\u0446\u0435\u043d\u043a\u0443: <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/f88\/07b\/f37\/f8807bf37fe6b7b3233fef522b691a4a.gif\"\/>.<\/p>\n<p>  \u0420\u0430\u043d\u0433\u0438 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/155\/bde\/9f5\/155bde9f50a1332adbefa9c833ae068f.gif\"\/> \u0438 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/8ca\/ebe\/078\/8caebe078b8f5a33590e85caea5439cd.gif\"\/> \u0441\u043e\u043a\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f. \u041a \u0444\u043e\u0440\u043c\u0443\u043b\u0435 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/270\/cbb\/bb6\/270cbbbb6cb0b4c0634e86f443bd3ab6.gif\"\/> \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043d\u0435\u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0430:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/0c5\/232\/69d\/0c523269dbad8d147f278380b9d4cb76.gif\"\/><\/div>\n<p>  \u0417\u043d\u0430\u0447\u0438\u0442, <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/11e\/019\/6f0\/11e0196f041a65b9712d2128d106eeaf.gif\"\/>. \u042d\u0442\u043e \u043d\u0435\u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e \u0434\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c\u0443 \u0441\u043b\u0443\u0447\u0430\u044e.<\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u0432\u0441\u0435 \u0442\u0440\u0438 \u0441\u043b\u0443\u0447\u0430\u044f \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0432\u0435\u0440\u0445\u043d\u044e\u044e \u043e\u0446\u0435\u043d\u043a\u0443 \u043d\u0430 \u0430\u043c\u043e\u0440\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0447\u0435\u0440\u0435\u0437 \u0440\u0430\u043d\u0433\u0438. <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/a8e\/bdf\/07e\/a8ebdf07e1219a23c6f51afadcf2d768.gif\"\/><\/p>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0440\u0430\u043d\u0433 \u043b\u044e\u0431\u043e\u0439 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0434\u0435\u0440\u0435\u0432\u0430. \u0418\u0437 \u0447\u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0442\u0435\u043e\u0440\u0435\u043c\u0430.<\/p>\n<p>  <b>\u0422\u0435\u043e\u0440\u0435\u043c\u0430<\/b>. \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f <code>splay<\/code> \u0430\u043c\u043e\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0437\u0430 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/84c\/07b\/cc9\/84c07bcc99d5fc8ab9086ace521ed96a.gif\"\/>.<\/p>\n<h4>\u0414\u0440\u0443\u0433\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430<\/h4>\n<p>  \u041d\u0430 \u0434\u0435\u0441\u0435\u0440\u0442 \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u0441\u043e\u0441\u043b\u0430\u0442\u044c\u0441\u044f \u043d\u0430 <a href=\"http:\/\/en.wikipedia.org\/wiki\/Splay_tree\">\u0432\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u044e<\/a> \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0444\u0430\u043a\u0442\u043e\u0432 \u043f\u0440\u043e <code>splay<\/code>-\u0434\u0435\u0440\u0435\u0432\u044c\u044f.<\/p>\n<p>  <b>\u0422\u0435\u043e\u0440\u0435\u043c\u0430 \u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/b>. \u041f\u0443\u0441\u0442\u044c <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/cad\/4e8\/f95\/cad4e8f9585700a0a979e4d098851bb4.gif\"\/> \u2014 \u0447\u0438\u0441\u043b\u043e \u0440\u0430\u0437, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u044b\u043b \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/882\/839\/fd0\/882839fd0d8c0796ef0f881d89ac3705.gif\"\/>. \u0422\u043e\u0433\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/601\/5f7\/e7e\/6015f7e7e19971bf1372e01171eaadcb.gif\"\/> \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e\u0438\u0441\u043a\u0430 \u043d\u0430 <code>splay<\/code>-\u0434\u0435\u0440\u0435\u0432\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0437\u0430 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/4e4\/afc\/38a\/4e4afc38a83dfc386be50875ee0dd12f.gif\"\/>.<\/p>\n<p>  \u041f\u043e \u0441\u0443\u0442\u0438 \u044d\u0442\u043e\u0442 \u0444\u0430\u043a\u0442 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435. \u041f\u0443\u0441\u0442\u044c \u043c\u044b \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0437\u043d\u0430\u0435\u043c, \u0432 \u043a\u0430\u043a\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0434\u0430\u043d\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u041c\u044b \u0441\u0442\u0440\u043e\u0438\u043c \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0430 \u044d\u0442\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435. \u0423\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442, \u0447\u0442\u043e \u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u043e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b <code>splay<\/code>-\u0434\u0435\u0440\u0435\u0432\u043e \u0431\u0443\u0434\u0435\u0442 \u0430\u043c\u043e\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435 \u0445\u0443\u0436\u0435, \u0447\u0435\u043c \u0441\u0430\u043c\u043e\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c. <\/p>\n<p>  <b>\u0422\u0435\u043e\u0440\u0435\u043c\u0430 \u043e \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435<\/b>. \u041f\u0443\u0441\u0442\u044c <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/41c\/9fd\/590\/41c9fd5903fa785884a1325457399279.gif\"\/> \u2014 \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0443\u0436\u0435 \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u043b\u0438 \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/12f\/ee3\/928\/12fee3928922dbe461d4bd49abc7df24.gif\"\/>; \u0435\u0441\u043b\u0438 \u0435\u0449\u0435 \u043d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u043b\u0438\u0441\u044c, \u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0447\u0438\u0441\u043b\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0430. \u0422\u043e\u0433\u0434\u0430 \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/601\/5f7\/e7e\/6015f7e7e19971bf1372e01171eaadcb.gif\"\/> \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/65d\/250\/85a\/65d25085aec30c33ef47e960ff608e05.gif\"\/>.<\/p>\n<p>  \u042d\u0442\u043e\u0442 \u0444\u0430\u043a\u0442 \u0444\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043c\u043e\u0435 \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0435 \u043e \u043a\u044d\u0448\u0435 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438. \u041f\u043e \u0441\u0443\u0442\u0438 \u043e\u043d \u0433\u043e\u0432\u043e\u0440\u0438\u0442, \u0447\u0442\u043e \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u0443\u043f\u043b\u044b\u0432\u0430\u0435\u0442 \u0434\u0430\u043b\u0435\u043a\u043e \u043e\u0442 \u043a\u043e\u0440\u043d\u044f.<\/p>\n<p>  <b>\u0421\u043a\u0430\u043d\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u0442\u0435\u043e\u0440\u0435\u043c\u0430<\/b> \u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f (LUR) \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c <code>splay<\/code>-\u0434\u0435\u0440\u0435\u0432\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0437\u0430 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/39a\/ed9\/498\/39aed9498a90431e37a7b32ffe2338cd.gif\"\/>.<\/p>\n<p>  \u042d\u0442\u043e\u0442 \u0444\u0430\u043a\u0442 \u0438\u043c\u0435\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435. \u0412\u043c\u0435\u0441\u0442\u0435 \u0441 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438 split \u0438 merge, \u043e\u043d \u0434\u0435\u043b\u0430\u0435\u0442 <code>splay<\/code>-\u0434\u0435\u0440\u0435\u0432\u044c\u044f \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u043e\u0439 \u0434\u043b\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445 <code>rope<\/code>. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u0430\u0445 \u0425\u0430\u0431\u0440\u0430 <a href=\"http:\/\/habrahabr.ru\/post\/144736\/\">Ropes \u2014 \u0431\u044b\u0441\u0442\u0440\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438<\/a> \u0438 <a href=\"http:\/\/habrahabr.ru\/post\/112394\/\">\u041c\u043e\u043d\u043e\u0438\u0434\u044b \u0438 \u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f&#8230;<\/a>.<\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435! <\/p>\n<h4>\u041b\u0438\u0442\u0435\u0440\u0430\u0442\u0443\u0440\u0430<\/h4>\n<p>  <\/p>\n<ul>\n<li>Tarjan \u00abData Structures and Networks Algorithms\u00bb<\/li>\n<li>Sleator, Daniel D.; Tarjan, Robert E. (1985), \u00abSelf-Adjusting Binary Search Trees\u00bb<\/li>\n<\/ul>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/210296\/\"> http:\/\/habrahabr.ru\/post\/210296\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0421\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u043e\u043c \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432. \u041d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u0445 \u043a\u043d\u0438\u0433 \u043f\u043e Computer Science \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u0440\u0430\u0441\u043d\u043e-\u0447\u0435\u0440\u043d\u044b\u0445, AVL-, B- \u0438 \u043c\u043d\u043e\u0433\u0438\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432. \u041d\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u043f\u0435\u0440\u043c\u0430\u043d\u0435\u043d\u0442\u043d\u0430\u044f \u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u044c \u0442\u0435\u043c \u0421\u0432\u044f\u0442\u044b\u043c \u0413\u0440\u0430\u0430\u043b\u0435\u043c, \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0433\u043e\u043d\u044f\u0442\u044c\u0441\u044f?<\/p>\n<p>  \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0443\u0436\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u0434\u0435\u0440\u0435\u0432\u043e \u043d\u0430 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/c7f\/092\/d48\/c7f092d481acb49c8a0f96178ceb3119.gif\"\/> \u043a\u043b\u044e\u0447\u0430\u0445 \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043b\u0435\u0436\u0438\u0442 \u043b\u0438 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0432 \u0434\u0435\u0440\u0435\u0432\u0435. \u041c\u043e\u0436\u0435\u0442 \u0442\u0430\u043a \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043e\u0434\u0438\u043d \u043a\u043b\u044e\u0447, \u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u043d \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0415\u0441\u043b\u0438 \u043a\u043b\u044e\u0447 \u043b\u0435\u0436\u0438\u0442 \u0434\u0430\u043b\u0435\u043a\u043e \u043e\u0442 \u043a\u043e\u0440\u043d\u044f, \u0442\u043e <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/601\/5f7\/e7e\/6015f7e7e19971bf1372e01171eaadcb.gif\"\/> \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043d\u044f\u0442\u044c <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/076\/63d\/c3c\/07663dc3c790b8c5e111597f71b68abc.gif\"\/> \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0417\u0434\u0440\u0430\u0432\u044b\u0439 \u0441\u043c\u044b\u0441\u043b \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u043e\u0446\u0435\u043d\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/7be\/274\/948\/7be27494810106e7a26b615c21f37527.gif\"\/>, \u043d\u0430\u0434\u0441\u0442\u0440\u043e\u0438\u0432 \u043d\u0430\u0434 \u0434\u0435\u0440\u0435\u0432\u043e\u043c \u043a\u044d\u0448. \u041d\u043e \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438 \u0438 \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e splay-\u0434\u0435\u0440\u0435\u0432\u044c\u044f\u0445. \u042d\u0442\u0438 \u0434\u0435\u0440\u0435\u0432\u044c\u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0435\u0440\u043c\u0430\u043d\u0435\u043d\u0442\u043d\u043e \u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u0430\u0436\u0435 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u041e\u0434\u043d\u0430\u043a\u043e, \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043e\u043d\u0438 \u043c\u0435\u043d\u044f\u044e\u0442 \u0441\u0432\u043e\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u044b. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0430\u043c\u043e\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0443 \u043d\u0438\u0445 <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/84c\/07b\/cc9\/84c07bcc99d5fc8ab9086ace521ed96a.gif\"\/>, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 splay-\u0434\u0435\u0440\u0435\u0432\u044c\u044f \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043e\u0439 \u0434\u043b\u044f \u043f\u0435\u0440\u043c\u0430\u043d\u0435\u043d\u0442\u043d\u043e \u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u0431\u0440\u0430\u0442\u044c\u0435\u0432.  <\/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-210296","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/210296","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=210296"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/210296\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=210296"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=210296"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=210296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}