{"id":30530,"date":"2019-10-31T21:36:01","date_gmt":"2019-10-31T18:36:01","guid":{"rendered":"https:\/\/prohoster.info\/blog\/binary-tree-ili-kak-prigotovit-binarnoe-derevo-poiska\/"},"modified":"2019-10-31T21:36:01","modified_gmt":"2019-10-31T18:36:01","slug":"binary-tree-ili-kak-prigotovit-binarnoe-derevo-poiska","status":"publish","type":"post","link":"https:\/\/prohoster.info\/bg\/blog\/administrirovanie\/binary-tree-ili-kak-prigotovit-binarnoe-derevo-poiska","title":{"rendered":"Binary Tree \u0438\u043b\u0438 \u043a\u0430\u043a \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u043f\u043e\u0438\u0441\u043a\u0430","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<h2>\u041f\u0440\u0435\u043b\u044e\u0434\u0438\u044f<\/h2>\n<p>\n\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u043c \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u043c \u043f\u043e\u0438\u0441\u043a\u0430. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0434\u0435\u043b\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u044e \u043f\u0440\u043e <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/438512\/\">\u0441\u0436\u0430\u0442\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430.<\/a><\/noindex> \u0422\u0430\u043c \u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043e\u0431\u0440\u0430\u0449\u0430\u043b \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0434\u0435\u0440\u0435\u0432\u044c\u044f, \u0438\u0431\u043e \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u043e\u0438\u0441\u043a\u0430, \u0432\u0441\u0442\u0430\u0432\u043a\u0438, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043d\u0435 \u0431\u044b\u043b\u0438 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b. \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u043e \u0434\u0435\u0440\u0435\u0432\u044c\u044f. \u041f\u043e\u0436\u0430\u043b\u0443\u0439, \u043d\u0430\u0447\u043d\u0435\u043c. <\/p>\n<p>\u0414\u0435\u0440\u0435\u0432\u043e \u2014 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0438\u0437 \u0443\u0437\u043b\u043e\u0432, \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0431\u0440\u0430\u043c\u0438. \u041c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0434\u0435\u0440\u0435\u0432\u043e \u2014 \u0447\u0430\u0441\u0442\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0433\u0440\u0430\u0444\u0430. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u0435\u0440\u0435\u0432\u0430: <\/p>\n<p><img decoding=\"async\" alt=\"Binary Tree \u0438\u043b\u0438 \u043a\u0430\u043a \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u043f\u043e\u0438\u0441\u043a\u0430\" src=\"\/wp-content\/uploads\/2019\/03\/502ac27f1b93f926c68a68777f6bddd7.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\n\u042d\u0442\u043e \u043d\u0435 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u043f\u043e\u0438\u0441\u043a\u0430! \u0412\u0441\u0435 \u043f\u043e\u0434 \u043a\u0430\u0442!<br \/>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<h2>\u0422\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u044f<\/h2>\n<p><\/p>\n<h4>\u041a\u043e\u0440\u0435\u043d\u044c<\/h4>\n<p>\n<i>\u041a\u043e\u0440\u0435\u043d\u044c \u0434\u0435\u0440\u0435\u0432\u0430<\/i> \u2014 \u044d\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u0435\u0433\u043e \u0443\u0437\u0435\u043b. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u2014 \u044d\u0442\u043e \u0443\u0437\u0435\u043b A. \u0412 \u0434\u0435\u0440\u0435\u0432\u0435 \u043e\u0442 \u043a\u043e\u0440\u043d\u044f \u043a \u043b\u044e\u0431\u043e\u043c\u0443 \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u0443\u0437\u043b\u0443 \u043c\u043e\u0436\u0435\u0442 \u0432\u0435\u0441\u0442\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u043f\u0443\u0442\u044c! \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043b\u044e\u0431\u043e\u0439 \u0443\u0437\u0435\u043b \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043a\u043e\u0440\u0435\u043d\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u0442\u043e\u043c\u0443 \u0443\u0437\u043b\u0443 \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u0430.<\/p>\n<h4>\u0420\u043e\u0434\u0438\u0442\u0435\u043b\u0438\/\u043f\u043e\u0442\u043e\u043c\u043a\u0438<\/h4>\n<p>\n\u0412\u0441\u0435 \u0443\u0437\u043b\u044b, \u043a\u0440\u043e\u043c\u0435 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0433\u043e, \u0438\u043c\u0435\u044e\u0442 \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u043d\u043e \u0440\u0435\u0431\u0440\u043e, \u0432\u0435\u0434\u0443\u0449\u0435\u0435 \u0432\u0432\u0435\u0440\u0445 \u043a \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u0443\u0437\u043b\u0443. \u0423\u0437\u0435\u043b, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <i>\u0440\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u043c<\/i> \u044d\u0442\u043e\u0433\u043e \u0443\u0437\u043b\u0430. \u0423\u0437\u0435\u043b, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043d\u0438\u0436\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e, \u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0439 \u0441 \u043d\u0438\u043c \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <i>\u043f\u043e\u0442\u043e\u043c\u043a\u043e\u043c<\/i> \u044d\u0442\u043e\u0433\u043e \u0443\u0437\u043b\u0430. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435. \u0412\u043e\u0437\u044c\u043c\u0435\u043c \u0443\u0437\u0435\u043b B, \u0442\u043e\u0433\u0434\u0430 \u0435\u0433\u043e \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u0443\u0437\u0435\u043b A, \u0430 \u043f\u043e\u0442\u043e\u043c\u043a\u0430\u043c\u0438 \u2014 \u0443\u0437\u043b\u044b D, E \u0438 F.<\/p>\n<h4>\u041b\u0438\u0441\u0442<\/h4>\n<p>\n\u0423\u0437\u0435\u043b, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435\u0442 \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432, \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043b\u0438\u0441\u0442\u043e\u043c \u0434\u0435\u0440\u0435\u0432\u0430. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043b\u0438\u0441\u0442\u044c\u044f\u043c\u0438 \u0431\u0443\u0434\u0443\u0442 \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0443\u0437\u043b\u044b D, E, F, G, I, J, K.<\/p>\n<p>\u042d\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u044f. \u0414\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d\u044b \u0434\u0430\u043b\u0435\u0435. \u0418\u0442\u0430\u043a, \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u2014 \u0434\u0435\u0440\u0435\u0432\u043e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u0443\u0437\u0435\u043b \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 \u0434\u0432\u0443\u0445 \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432. \u041a\u0430\u043a \u0432\u044b \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c, \u0434\u0435\u0440\u0435\u0432\u043e \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u043c, \u0438\u0431\u043e \u0443\u0437\u043b\u044b B \u0438 H \u0438\u043c\u0435\u044e\u0442 \u0431\u043e\u043b\u0435\u0435 \u0434\u0432\u0443\u0445 \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430:<\/p>\n<p><img decoding=\"async\" alt=\"Binary Tree \u0438\u043b\u0438 \u043a\u0430\u043a \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u043f\u043e\u0438\u0441\u043a\u0430\" src=\"\/wp-content\/uploads\/2019\/03\/2f587bd1c428d3850cb0163d6c2984a1.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\n\u0412 \u0443\u0437\u043b\u0430\u0445 \u0434\u0435\u0440\u0435\u0432\u0430 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043b\u044e\u0431\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f. \u0414\u0432\u043e\u0438\u0447\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u2014 \u044d\u0442\u043e \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430:<\/p>\n<ol>\n<li>\u041e\u0431\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u0430 \u2014 \u043b\u0435\u0432\u043e\u0435 \u0438 \u043f\u0440\u0430\u0432\u043e\u0435 \u2014 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0434\u0432\u043e\u0438\u0447\u043d\u044b\u043c\u0438 \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u043c\u0438 \u043f\u043e\u0438\u0441\u043a\u0430.<\/li>\n<li>\u0423 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u043e\u0432 \u043b\u0435\u0432\u043e\u0433\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0443\u0437\u043b\u0430 X \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u043d\u044c\u0448\u0435, \u043d\u0435\u0436\u0435\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u0430\u043c\u043e\u0433\u043e \u0443\u0437\u043b\u0430 X.<\/li>\n<li>\u0423 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u043e\u0432 \u043f\u0440\u0430\u0432\u043e\u0433\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0443\u0437\u043b\u0430 X \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u043e\u043b\u044c\u0448\u0435 \u043b\u0438\u0431\u043e \u0440\u0430\u0432\u043d\u044b, \u043d\u0435\u0436\u0435\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u0430\u043c\u043e\u0433\u043e \u0443\u0437\u043b\u0430 X. <\/li>\n<\/ol>\n<p><i>\u041a\u043b\u044e\u0447<\/i> \u2014 \u043a\u0430\u043a\u0430\u044f-\u043b\u0438\u0431\u043e \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430 \u0443\u0437\u043b\u0430(\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0438\u0441\u043b\u043e). \u041a\u043b\u044e\u0447 \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043d\u0430\u0439\u0442\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0434\u0435\u0440\u0435\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u044d\u0442\u043e\u0442 \u043a\u043b\u044e\u0447. \u041f\u0440\u0438\u043c\u0435\u0440 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430 \u043f\u043e\u0438\u0441\u043a\u0430:<\/p>\n<p><img decoding=\"async\" alt=\"Binary Tree \u0438\u043b\u0438 \u043a\u0430\u043a \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u043f\u043e\u0438\u0441\u043a\u0430\" src=\"\/wp-content\/uploads\/2019\/03\/a70ca7d2fdf289b5d1e14bdb4bc38b00.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<\/p>\n<h2>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0435\u0440\u0435\u0432\u0430<\/h2>\n<p>\n\u041f\u043e \u043c\u0435\u0440\u0435 \u043f\u0440\u043e\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u044f \u0431\u0443\u0434\u0443 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435(\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0435\u043f\u043e\u043b\u043d\u044b\u0435) \u043a\u0443\u0441\u043a\u0438 \u043a\u043e\u0434\u0430, \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0432\u0430\u0448\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435. \u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438. <\/p>\n<p>\u0414\u0435\u0440\u0435\u0432\u043e \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0443\u0437\u043b\u043e\u0432. \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0443\u0437\u043b\u0430:<\/p>\n<pre><code class=\"java\">public class Node&lt;T&gt; {\n    private T data;\n    private int key;\n    private Node&lt;T&gt; leftChild;\n    private Node&lt;T&gt; rightChild;\n\n    public Node(T data, int key) {\n        this.data = data;\n        this.key = key;\n    }\n    public Node&lt;T&gt; getLeftChild() {\n        return leftChild;\n    }\n\n    public Node&lt;T&gt; getRightChild() {\n        return rightChild;\n    }\n\/\/...\u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0443\u0437\u043b\u0430\n}\n<\/code><\/pre>\n<p>\n\u041a\u0430\u0436\u0434\u044b\u0439 \u0443\u0437\u0435\u043b \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0443\u0445 \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432(\u0432\u043f\u043e\u043b\u043d\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u043a\u0438 leftChild \u0438\/\u0438\u043b\u0438 rightChild \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 null). \u0412\u044b, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u043f\u043e\u043d\u044f\u043b\u0438, \u0447\u0442\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0447\u0438\u0441\u043b\u043e data \u2014 \u0434\u0430\u043d\u043d\u044b\u0435, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0435\u0441\u044f \u0432 \u0443\u0437\u043b\u0435; key \u2014 \u043a\u043b\u044e\u0447 \u0443\u0437\u043b\u0430.<\/p>\n<p>\u0421 \u0443\u0437\u043b\u043e\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0445 \u043d\u0430\u0441\u0443\u0449\u043d\u044b\u0445 \u043e \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u0445. \u0417\u0434\u0435\u0441\u044c \u0438 \u0434\u0430\u043b\u0435\u0435 \u043f\u043e\u0434 \u0441\u043b\u043e\u0432\u043e\u043c \u00ab\u0434\u0435\u0440\u0435\u0432\u043e\u00bb \u0431\u0443\u0434\u0443 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u0438\u0435 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430 \u043f\u043e\u0438\u0441\u043a\u0430. \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430:<\/p>\n<pre><code class=\"java\">public class BinaryTree&lt;T&gt; {\n     private Node&lt;T&gt; root;\n\n    \/\/\u043c\u0435\u0442\u043e\u0434\u044b \u0434\u0435\u0440\u0435\u0432\u0430\n}\n<\/code><\/pre>\n<p>\u041a\u0430\u043a \u043f\u043e\u043b\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0440\u0435\u043d\u044c \u0434\u0435\u0440\u0435\u0432\u0430, \u0438\u0431\u043e \u043e\u0442 \u043a\u043e\u0440\u043d\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 getLeftChild() \u0438 getRightChild() \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0434\u043e \u043b\u044e\u0431\u043e\u0433\u043e \u0443\u0437\u043b\u0430 \u0434\u0435\u0440\u0435\u0432\u0430.<\/p>\n<h2>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0432 \u0434\u0435\u0440\u0435\u0432\u0435<\/h2>\n<p><\/p>\n<h3>\u041f\u043e\u0438\u0441\u043a<\/h3>\n<p>\n\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e. \u041a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441 \u043a\u043b\u044e\u0447\u043e\u043c key? \u041d\u0443\u0436\u043d\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043a\u043e\u0440\u043d\u044f \u0432\u043d\u0438\u0437 \u043f\u043e \u0434\u0435\u0440\u0435\u0432\u0443 \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 key \u0441 \u043a\u043b\u044e\u0447\u043e\u043c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0433\u043e \u0443\u0437\u043b\u0430: \u0435\u0441\u043b\u0438 key \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u043a\u043b\u044e\u0447 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0433\u043e \u0443\u0437\u043b\u0430, \u0442\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u043b\u0435\u0432\u043e\u043c\u0443 \u043f\u043e\u0442\u043e\u043c\u043a\u0443 \u0443\u0437\u043b\u0430, \u0435\u0441\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u2014 \u043a \u043f\u0440\u0430\u0432\u043e\u043c\u0443, \u0435\u0441\u043b\u0438 \u043a\u043b\u044e\u0447\u0438 \u0440\u0430\u0432\u043d\u044b \u2014 \u0438\u0441\u043a\u043e\u043c\u044b\u0439 \u0443\u0437\u0435\u043b \u043d\u0430\u0439\u0434\u0435\u043d! \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"java\">public Node&lt;T&gt; find(int key) {\n    Node&lt;T&gt; current = root;\n    while (current.getKey() != key) {\n        if (key &lt; current.getKey())\n            current = current.getLeftChild();\n        else\n            current = current.getRightChild();\n        if (current == null)\n            return null;\n    }\n    return current;\n}\n<\/code><\/pre>\n<p>\n\u0415\u0441\u043b\u0438 current \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0440\u0430\u0432\u043d\u044b\u043c null, \u0437\u043d\u0430\u0447\u0438\u0442, \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u0434\u043e\u0441\u0442\u0438\u0433 \u043a\u043e\u043d\u0446\u0430 \u0434\u0435\u0440\u0435\u0432\u0430(\u043d\u0430 \u043a\u043e\u043d\u0446\u0435\u043f\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0432\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0435\u0441\u044c \u0432 \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c \u043c\u0435\u0441\u0442\u0435 \u0434\u0435\u0440\u0435\u0432\u0430 \u2014 \u043f\u043e\u0442\u043e\u043c\u043a\u0435 \u043b\u0438\u0441\u0442\u0430).<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043f\u043e\u0438\u0441\u043a\u0430 \u043d\u0430 \u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0434\u0435\u0440\u0435\u0432\u0435(\u0434\u0435\u0440\u0435\u0432\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443\u0437\u043b\u044b \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e). \u0422\u043e\u0433\u0434\u0430 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0438\u0441\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 O(log(n)), \u043f\u0440\u0438\u0447\u0435\u043c \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u044e 2. \u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435: \u0435\u0441\u043b\u0438 \u0432 \u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0434\u0435\u0440\u0435\u0432\u0435 n \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0442\u043e \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 log(n) \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u044e 2 \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u0434\u0435\u0440\u0435\u0432\u0430. \u0410 \u0432 \u043f\u043e\u0438\u0441\u043a\u0435, \u0437\u0430 \u043e\u0434\u0438\u043d \u0448\u0430\u0433 \u0446\u0438\u043a\u043b\u0430, \u0432\u044b \u0441\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0435\u0441\u044c \u043d\u0430 \u043e\u0434\u0438\u043d \u0443\u0440\u043e\u0432\u0435\u043d\u044c.<\/p>\n<h3>\u0412\u0441\u0442\u0430\u0432\u043a\u0430<\/h3>\n<p>\n\u0415\u0441\u043b\u0438 \u0432\u044b \u0443\u043b\u043e\u0432\u0438\u043b\u0438 \u0441\u0443\u0442\u044c \u043f\u043e\u0438\u0441\u043a\u0430, \u0442\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u0432\u0441\u0442\u0430\u0432\u043a\u0443 \u043d\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442 \u0432\u0430\u043c \u0442\u0440\u0443\u0434\u0430. \u041d\u0430\u0434\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043f\u0443\u0441\u0442\u0438\u0442\u044c\u0441\u044f \u0434\u043e \u043b\u0438\u0441\u0442\u0430 \u0434\u0435\u0440\u0435\u0432\u0430(\u043f\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c \u0441\u043f\u0443\u0441\u043a\u0430, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u0432 \u043f\u043e\u0438\u0441\u043a\u0435) \u0438 \u0441\u0442\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u043c \u2014 \u043b\u0435\u0432\u044b\u043c, \u0438\u043b\u0438 \u043f\u0440\u0430\u0432\u044b\u043c, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043b\u044e\u0447\u0430. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f:<\/p>\n<pre><code class=\"java\">   public void insert(T insertData, int key) {\n        Node&lt;T&gt; current = root;\n        Node&lt;T&gt; parent;\n        Node&lt;T&gt; newNode = new Node&lt;&gt;(insertData, key);\n        if (root == null)\n            root = newNode;\n        else {\n            while (true) {\n                parent = current;\n                if (key &lt; current.getKey()) {\n                    current = current.getLeftChild();\n                    if (current == null) {\n                         parent.setLeftChild(newNode);\n                         return;\n                    }\n                }\n                else {\n                    current = current.getRightChild();\n                    if (current == null) {\n                        parent.setRightChild(newNode);\n                        return;\n                    }\n                }\n            }\n        }\n    }\n<\/code><\/pre>\n<p>\n\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u0434\u043e, \u043f\u043e\u043c\u0438\u043c\u043e \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0443\u0437\u043b\u0430, \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0443\u0437\u043b\u0430. \u041a\u043e\u0433\u0434\u0430 current \u0441\u0442\u0430\u043d\u0435\u0442 \u0440\u0430\u0432\u043d\u044b\u043c null, \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 parent \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0439 \u043d\u0430\u043c \u043b\u0438\u0441\u0442. <br \/>\n\u042d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0432\u0441\u0442\u0430\u0432\u043a\u0438, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u043a\u0430\u043a \u0438 \u0443 \u043f\u043e\u0438\u0441\u043a\u0430 \u2014 O(log(n)).<\/p>\n<h3>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435<\/h3>\n<p>\n\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u2014 \u0441\u0430\u043c\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0441 \u0434\u0435\u0440\u0435\u0432\u043e\u043c. \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0443\u0434\u0430\u043b\u044f\u0442\u044c. \u041d\u043e \u0447\u0442\u043e \u043f\u043e\u0442\u043e\u043c? \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0435\u0433\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 null, \u0442\u043e \u043c\u044b \u043f\u043e\u0442\u0435\u0440\u044f\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u0435, \u043a\u043e\u0440\u043d\u0435\u043c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044d\u0442\u043e\u0442 \u0443\u0437\u0435\u043b. \u041c\u0435\u0442\u043e\u0434\u044b \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0434\u0435\u0440\u0435\u0432\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0442 \u043d\u0430 \u0442\u0440\u0438 \u0441\u043b\u0443\u0447\u0430\u044f.<\/p>\n<h4>\u041f\u0435\u0440\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439. \u0423\u0434\u0430\u043b\u044f\u0435\u043c\u044b\u0439 \u0443\u0437\u0435\u043b \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432<\/h4>\n<p>\n\u0415\u0441\u043b\u0438 \u0443\u0434\u0430\u043b\u044f\u0435\u043c\u044b\u0439 \u0443\u0437\u0435\u043b \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432, \u0442\u043e \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438\u0441\u0442\u043e\u043c. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043b\u044f\u043c leftChild \u0438\u043b\u0438 rightChild \u0435\u0433\u043e \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 null. <\/p>\n<h4>\u0412\u0442\u043e\u0440\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439. \u0423\u0434\u0430\u043b\u044f\u0435\u043c\u044b\u0439 \u0443\u0437\u0435\u043b \u0438\u043c\u0435\u0435\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043c\u043a\u0430<\/h4>\n<p>\n\u042d\u0442\u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439 \u0442\u043e\u0436\u0435 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0439. \u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u0443. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043d\u0430\u0434\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441 \u043a\u043b\u044e\u0447\u043e\u043c 14. \u0421\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u2014 \u043f\u0440\u0430\u0432\u044b\u0439 \u043f\u043e\u0442\u043e\u043c\u043e\u043a \u0443\u0437\u043b\u0430 \u0441 \u043a\u043b\u044e\u0447\u043e\u043c 10, \u0442\u043e \u043b\u044e\u0431\u043e\u0439 \u0435\u0433\u043e \u043f\u043e\u0442\u043e\u043c\u043e\u043a(\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0430\u0432\u044b\u0439) \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043a\u043b\u044e\u0447, \u0431\u043e\u043b\u044c\u0448\u0438\u0439 10, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0435\u0433\u043e \u00ab\u0432\u044b\u0440\u0435\u0437\u0430\u0442\u044c\u00bb \u0438\u0437 \u0434\u0435\u0440\u0435\u0432\u0430, \u0430 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0441 \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u043c \u0443\u0434\u0430\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u0443\u0437\u043b\u0430, \u0442.\u0435. \u0443\u0437\u0435\u043b \u0441 \u043a\u043b\u044e\u0447\u043e\u043c 10 \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0441 \u0443\u0437\u043b\u043e\u043c 13. \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0439 \u0431\u044b\u043b\u0430 \u0431\u044b \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u0435\u0441\u043b\u0438 \u0431\u044b \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0443\u0437\u0435\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0435\u0432\u044b\u043c \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u043c \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f. \u041f\u043e\u0434\u0443\u043c\u0430\u0439\u0442\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c \u0441\u0430\u043c\u0438 \u2014 \u0442\u043e\u0447\u043d\u0430\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u044f. <\/p>\n<h4>\u0422\u0440\u0435\u0442\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439. \u0423\u0437\u0435\u043b \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0443\u0445 \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432<\/h4>\n<p>\n\u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439. \u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043d\u0430 \u043d\u043e\u0432\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435.<\/p>\n<p><img decoding=\"async\" alt=\"Binary Tree \u0438\u043b\u0438 \u043a\u0430\u043a \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u043f\u043e\u0438\u0441\u043a\u0430\" src=\"\/wp-content\/uploads\/2019\/03\/0d600478e4a046ae6f7267be49b231bc.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<\/p>\n<h4>\u041f\u043e\u0438\u0441\u043a \u043f\u0440\u0435\u0435\u043c\u043d\u0438\u043a\u0430<\/h4>\n<p>\n \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043d\u0430\u0434\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0443\u0437\u0435\u043b \u0441 \u043a\u043b\u044e\u0447\u043e\u043c 25. \u041a\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u043d\u0430 \u0435\u0433\u043e \u043c\u0435\u0441\u0442\u043e? \u041a\u0442\u043e-\u0442\u043e \u0438\u0437 \u0435\u0433\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439(\u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432 \u0438\u043b\u0438 \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432 \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432) \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0442\u0430\u0442\u044c <i>\u043f\u0440\u0435\u0435\u043c\u043d\u0438\u043a\u043e\u043c<\/i>(\u0442\u043e\u0442, \u043a\u0442\u043e \u0437\u0430\u0439\u043c\u0435\u0442 \u043c\u0435\u0441\u0442\u043e \u0443\u0434\u0430\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u0443\u0437\u043b\u0430). <\/p>\n<p>\u041a\u0430\u043a \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0442\u0430\u0442\u044c \u043f\u0440\u0435\u0435\u043c\u043d\u0438\u043a\u043e\u043c? \u0418\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u0443\u0437\u0435\u043b \u0432 \u0434\u0435\u0440\u0435\u0432\u0435, \u043a\u043b\u044e\u0447 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u2014 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u043e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0435 \u043e\u0442 \u0443\u0434\u0430\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u0443\u0437\u043b\u0430. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c. \u041d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0435\u0433\u043e \u043f\u0440\u0430\u0432\u043e\u043c\u0443 \u043f\u043e\u0442\u043e\u043c\u043a\u0443(\u0432\u0441\u0435\u0433\u0434\u0430 \u043a \u043f\u0440\u0430\u0432\u043e\u043c\u0443, \u0438\u0431\u043e \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043a\u043b\u044e\u0447 \u043f\u0440\u0435\u0435\u043c\u043d\u0438\u043a\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u043b\u044e\u0447\u0430 \u0443\u0434\u0430\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u0443\u0437\u043b\u0430), \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0439\u0442\u0438\u0441\u044c \u043f\u043e \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u043b\u0435\u0432\u044b\u0445 \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0430\u0432\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043c\u043a\u0430. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0443\u0437\u043b\u0443 \u0441 \u043a\u043b\u044e\u0447\u043e\u043c 35, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0439\u0442\u0438\u0441\u044c \u0434\u043e \u043b\u0438\u0441\u0442\u0430 \u0432\u043d\u0438\u0437 \u043f\u043e \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u0435\u0433\u043e \u043b\u0435\u0432\u044b\u0445 \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432 \u2014 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u044d\u0442\u0430 \u0446\u0435\u043f\u043e\u0447\u043a\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u0443\u0437\u043b\u0430 \u0441 \u043a\u043b\u044e\u0447\u043e\u043c 30. \u0421\u0442\u0440\u043e\u0433\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u043c\u044b \u0438\u0449\u0435\u043c \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0439 \u0443\u0437\u0435\u043b \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u0443\u0437\u043b\u043e\u0432, \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0438\u0441\u043a\u043e\u043c\u043e\u0433\u043e \u0443\u0437\u043b\u0430.<\/p>\n<p><img decoding=\"async\" alt=\"Binary Tree \u0438\u043b\u0438 \u043a\u0430\u043a \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u043f\u043e\u0438\u0441\u043a\u0430\" src=\"\/wp-content\/uploads\/2019\/03\/50c4e3e49111eec9e1fd13083ee9b9b0.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\n\u041a\u043e\u0434 \u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u0440\u0435\u0435\u043c\u043d\u0438\u043a\u0430:<\/p>\n<pre><code class=\"java\">    public Node&lt;T&gt; getSuccessor(Node&lt;T&gt; deleteNode) {\n        Node&lt;T&gt; parentSuccessor = deleteNode;\/\/\u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u043f\u0440\u0435\u0435\u043c\u043d\u0438\u043a\u0430\n        Node&lt;T&gt; successor = deleteNode;\/\/\u043f\u0440\u0435\u0435\u043c\u043d\u0438\u043a\n        Node&lt;T&gt; current = successor.getRightChild();\/\/\u043f\u0440\u043e\u0441\u0442\u043e \"\u043f\u0440\u043e\u0431\u0435\u0433\u0430\u044e\u0449\u0438\u0439\" \u0443\u0437\u0435\u043b\n        while (current != null) {\n            parentSuccessor = successor;\n            successor = current;\n            current = current.getLeftChild();\n        }\n        \/\/\u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0438\u0437 \u0446\u0438\u043a\u043b\u0430 \u0438\u043c\u0435\u0435\u043c \u043f\u0440\u0435\u0435\u043c\u043d\u0438\u043a\u0430 \u0438 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u043f\u0440\u0435\u0435\u043c\u043d\u0438\u043a\u0430\n        if (successor != deleteNode.getRightChild()) {\/\/\u0435\u0441\u043b\u0438 \u043f\u0440\u0435\u0435\u043c\u043d\u0438\u043a \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043f\u0440\u0430\u0432\u044b\u043c \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u043c \u0443\u0434\u0430\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u0443\u0437\u043b\u0430\n            parentSuccessor.setLeftChild(successor.getRightChild());\/\/\u0442\u043e \u0435\u0433\u043e \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0437\u0430\u0431\u0438\u0440\u0430\u0435\u0442 \u0441\u0435\u0431\u0435 \u043f\u043e\u0442\u043e\u043c\u043a\u0430 \u043f\u0440\u0435\u0435\u043c\u043d\u0438\u043a\u0430, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u043e\u0442\u0435\u0440\u044f\u0442\u044c \u0435\u0433\u043e\n            successor.setRightChild(deleteNode.getRightChild());\/\/\u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u0435\u0435\u043c\u043d\u0438\u043a\u0430 \u0441 \u043f\u0440\u0430\u0432\u044b\u043c \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u043c \u0443\u0434\u0430\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u0443\u0437\u043b\u0430\n        }\n        return successor;\n    }\n<\/code><\/pre>\n<p>\n\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u0435\u0442\u043e\u0434\u0430 delete:<\/p>\n<pre><code class=\"java\">public boolean delete(int deleteKey) {\n        Node&lt;T&gt; current = root;\n        Node&lt;T&gt; parent = current;\n        boolean isLeftChild = false;\/\/\u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438  \u0443\u0434\u0430\u043b\u044f\u0435\u043c\u044b\u0439 \u0443\u0437\u0435\u043b \u043b\u0435\u0432\u044b\u043c \u0438\u043b\u0438 \u043f\u0440\u0430\u0432\u044b\u043c \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u043c \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f, \u0431\u0443\u043b\u0435\u0432\u0441\u043a\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f isLeftChild \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 true \u0438\u043b\u0438 false \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.\n        while (current.getKey() != deleteKey) {\n            parent = current;\n            if (deleteKey &lt; current.getKey()) {\n                current = current.getLeftChild();\n                isLeftChild = true;\n            } else {\n                isLeftChild = false;\n                current = current.getRightChild();\n            }\n            if (current == null)\n                return false;\n        }\n\n        if (current.getLeftChild() == null &amp;&amp; current.getRightChild() == null) {\/\/\u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\n            if (current == root)\n                current = null;\n            else if (isLeftChild)\n                parent.setLeftChild(null);\n            else\n                parent.setRightChild(null);\n        }\n        else if (current.getRightChild() == null) {\/\/\u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\n            if (current == root)\n                root = current.getLeftChild();\n            else if (isLeftChild)\n                parent.setLeftChild(current.getLeftChild());\n            else\n                current.setRightChild(current.getLeftChild());\n        } else if (current.getLeftChild() == null) {\n            if (current == root)\n                root = current.getRightChild();\n            else if (isLeftChild)\n                parent.setLeftChild(current.getRightChild());\n            else\n                parent.setRightChild(current.getRightChild());\n        } \n        else {\/\/\u0442\u0440\u0435\u0442\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\n            Node&lt;T&gt; successor = getSuccessor(current);\n            if (current == root)\n                root = successor;\n            else if (isLeftChild)\n                parent.setLeftChild(successor);\n            else\n                parent.setRightChild(successor);\n        }\n        return true;\n    }\n<\/code><\/pre>\n<p>\n\u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043a O(log(n)).<\/p>\n<h3>\u041f\u043e\u0438\u0441\u043a \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u0430\/\u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430 \u0432 \u0434\u0435\u0440\u0435\u0432\u0435<\/h3>\n<p>\n\u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u043a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435\/\u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0434\u0435\u0440\u0435\u0432\u0435 \u2014 \u043d\u0430\u0434\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043f\u043e \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u043b\u0435\u0432\u044b\u0445\/\u043f\u0440\u0430\u0432\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u0435\u0440\u0435\u0432\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e; \u043a\u043e\u0433\u0434\u0430 \u0434\u043e\u0431\u0435\u0440\u0435\u0442\u0435\u0441\u044c \u0434\u043e \u043b\u0438\u0441\u0442\u0430, \u043e\u043d \u0438 \u0431\u0443\u0434\u0435\u0442 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c\/\u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c.<\/p>\n<pre><code class=\"java\">    public Node&lt;T&gt; getMinimum(Node&lt;T&gt; startPoint) {\n        Node&lt;T&gt; current = startPoint;\n        Node&lt;T&gt; parent = current;\n        while (current != null) {\n            parent = current;\n            current = current.getLeftChild();\n        }\n        return parent;\n    }\n\n    public Node&lt;T&gt; getMaximum(Node&lt;T&gt; startPoint) {\n        Node&lt;T&gt; current = startPoint;\n        Node&lt;T&gt; parent = current;\n        while (current != null) {\n            parent = current;\n            current = current.getRightChild();\n        }\n        return parent;\n    }\n<\/code><\/pre>\n<p>\n\u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u2014 O(log(n))<\/p>\n<h3>\u0421\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u0439 \u043e\u0431\u0445\u043e\u0434<\/h3>\n<p>\n\u041e\u0431\u0445\u043e\u0434 \u2014 \u043f\u043e\u0441\u0435\u0449\u0435\u043d\u0438\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0443\u0437\u043b\u0430 \u0434\u0435\u0440\u0435\u0432\u0430 \u0441 \u0446\u0435\u043b\u044c\u044e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043d\u0438\u043c \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435.<\/p>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e\u0433\u043e \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0433\u043e \u043e\u0431\u0445\u043e\u0434\u0430:<\/p>\n<ol>\n<li>\u0421\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u043b\u0435\u0432\u044b\u043c \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u043c<\/li>\n<li>\u0421\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0441\u043e\u0431\u043e\u0439<\/li>\n<li>\u0421\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u043f\u0440\u0430\u0432\u044b\u043c \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u043c<\/li>\n<\/ol>\n<p>\n\u041a\u043e\u0434:<\/p>\n<pre><code class=\"java\">    public void inOrder(Node&lt;T&gt; current) {\n        if (current != null) {\n            inOrder(current.getLeftChild());\n            System.out.println(current.getData() + \" \");\/\/\u0417\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u0441\u0435, \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e\n            inOrder(current.getRightChild());\n        }\n    }\n<\/code><\/pre>\n<p><\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\n\u041d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e! \u0415\u0441\u043b\u0438 \u044f \u0447\u0442\u043e-\u0442\u043e \u043d\u0435\u0434\u043e\u043e\u0431\u044a\u044f\u0441\u043d\u0438\u043b \u0438\u043b\u0438 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f, \u0442\u043e \u0436\u0434\u0443 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445. \u041a\u0430\u043a \u043e\u0431\u0435\u0449\u0430\u043b, \u043f\u0440\u0438\u0432\u043e\u0436\u0443 \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434.<\/p>\n<p>Node.java:<\/p>\n<pre><code class=\"java\">public class Node&lt;T&gt; {\n    private T data;\n    private int key;\n    private Node&lt;T&gt; leftChild;\n    private Node&lt;T&gt; rightChild;\n\n    public Node(T data, int key) {\n        this.data = data;\n        this.key = key;\n    }\n\n    public void setLeftChild(Node&lt;T&gt; newNode) {\n        leftChild = newNode;\n    }\n\n    public void setRightChild(Node&lt;T&gt; newNode) {\n        rightChild = newNode;\n    }\n\n    public Node&lt;T&gt; getLeftChild() {\n        return leftChild;\n    }\n\n    public Node&lt;T&gt; getRightChild() {\n        return rightChild;\n    }\n\n    public T getData() {\n        return data;\n    }\n\n    public int getKey() {\n        return key;\n    }\n}\n\n<\/code><\/pre>\n<p>\nBinaryTree.java:<\/p>\n<pre><code class=\"java\">public class BinaryTree&lt;T&gt; {\n    private Node&lt;T&gt; root;\n\n    public Node&lt;T&gt; find(int key) {\n        Node&lt;T&gt; current = root;\n        while (current.getKey() != key) {\n            if (key &lt; current.getKey())\n                current = current.getLeftChild();\n            else\n                current = current.getRightChild();\n            if (current == null)\n                return null;\n        }\n        return current;\n    }\n\n    public void insert(T insertData, int key) {\n        Node&lt;T&gt; current = root;\n        Node&lt;T&gt; parent;\n        Node&lt;T&gt; newNode = new Node&lt;&gt;(insertData, key);\n        if (root == null)\n            root = newNode;\n        else {\n            while (true) {\n                parent = current;\n                if (key &lt; current.getKey()) {\n                    current = current.getLeftChild();\n                    if (current == null) {\n                         parent.setLeftChild(newNode);\n                         return;\n                    }\n                }\n                else {\n                    current = current.getRightChild();\n                    if (current == null) {\n                        parent.setRightChild(newNode);\n                        return;\n                    }\n                }\n            }\n        }\n    }\n\n    public Node&lt;T&gt; getMinimum(Node&lt;T&gt; startPoint) {\n        Node&lt;T&gt; current = startPoint;\n        Node&lt;T&gt; parent = current;\n        while (current != null) {\n            parent = current;\n            current = current.getLeftChild();\n        }\n        return parent;\n    }\n\n    public Node&lt;T&gt; getMaximum(Node&lt;T&gt; startPoint) {\n        Node&lt;T&gt; current = startPoint;\n        Node&lt;T&gt; parent = current;\n        while (current != null) {\n            parent = current;\n            current = current.getRightChild();\n        }\n        return parent;\n    }\n\n    public Node&lt;T&gt; getSuccessor(Node&lt;T&gt; deleteNode) {\n        Node&lt;T&gt; parentSuccessor = deleteNode;\n        Node&lt;T&gt; successor = deleteNode;\n        Node&lt;T&gt; current = successor.getRightChild();\n        while (current != null) {\n            parentSuccessor = successor;\n            successor = current;\n            current = current.getLeftChild();\n        }\n\n        if (successor != deleteNode.getRightChild()) {\n            parentSuccessor.setLeftChild(successor.getRightChild());\n            successor.setRightChild(deleteNode.getRightChild());\n        }\n        return successor;\n    }\n\n    public boolean delete(int deleteKey) {\n        Node&lt;T&gt; current = root;\n        Node&lt;T&gt; parent = current;\n        boolean isLeftChild = false;\n        while (current.getKey() != deleteKey) {\n            parent = current;\n            if (deleteKey &lt; current.getKey()) {\n                current = current.getLeftChild();\n                isLeftChild = true;\n            } else {\n                isLeftChild = false;\n                current = current.getRightChild();\n            }\n            if (current == null)\n                return false;\n        }\n\n        if (current.getLeftChild() == null &amp;&amp; current.getRightChild() == null) {\n            if (current == root)\n                current = null;\n            else if (isLeftChild)\n                parent.setLeftChild(null);\n            else\n                parent.setRightChild(null);\n        }\n        else if (current.getRightChild() == null) {\n            if (current == root)\n                root = current.getLeftChild();\n            else if (isLeftChild)\n                parent.setLeftChild(current.getLeftChild());\n            else\n                current.setRightChild(current.getLeftChild());\n        } else if (current.getLeftChild() == null) {\n            if (current == root)\n                root = current.getRightChild();\n            else if (isLeftChild)\n                parent.setLeftChild(current.getRightChild());\n            else\n                parent.setRightChild(current.getRightChild());\n        } \n        else {\n            Node&lt;T&gt; successor = getSuccessor(current);\n            if (current == root)\n                root = successor;\n            else if (isLeftChild)\n                parent.setLeftChild(successor);\n            else\n                parent.setRightChild(successor);\n        }\n        return true;\n    }\n\n    public void inOrder(Node&lt;T&gt; current) {\n        if (current != null) {\n            inOrder(current.getLeftChild());\n            System.out.println(current.getData() + \" \");\n            inOrder(current.getRightChild());\n        }\n    }\n}\n<\/code><\/pre>\n<h2>P.S.<\/h2>\n<p><\/p>\n<h3>\u0412\u044b\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0434\u043e O(n)<\/h3>\n<p>\n\u041c\u043d\u043e\u0433\u0438\u0435 \u0438\u0437 \u0432\u0430\u0441 \u043c\u043e\u0433\u043b\u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c: \u0430 \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0434\u0435\u0440\u0435\u0432\u043e \u0441\u0442\u0430\u043b\u043e \u043d\u0435\u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c? \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043b\u0430\u0441\u0442\u044c \u0432 \u0434\u0435\u0440\u0435\u0432\u043e \u0443\u0437\u043b\u044b \u0441 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u044e\u0449\u0438\u043c\u0438 \u043a\u043b\u044e\u0447\u0430\u043c\u0438: 1,2,3,4,5,6\u2026 \u0412\u043e\u0442 \u0442\u043e\u0433\u0434\u0430 \u0434\u0435\u0440\u0435\u0432\u043e \u0431\u0443\u0434\u0435\u0442 \u0447\u0435\u043c-\u0442\u043e \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0442\u044c \u0441\u0432\u044f\u0437\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a. \u0418 \u0434\u0430, \u0434\u0435\u0440\u0435\u0432\u043e \u043f\u043e\u0442\u0435\u0440\u044f\u0435\u0442 \u0441\u0432\u043e\u044e \u0434\u0440\u0435\u0432\u043e\u0432\u0438\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u0430 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c. \u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043f\u043e\u0438\u0441\u043a\u0430, \u0432\u0441\u0442\u0430\u0432\u043a\u0438, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u043d\u0443\u0442 \u0442\u0430\u043a\u0438\u043c\u0438, \u043a\u0430\u043a \u0443 \u0441\u0432\u044f\u0437\u043d\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430: O(n). \u0412 \u044d\u0442\u043e\u043c \u0438 \u043f\u0440\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0438\u0437 \u0432\u0430\u0436\u043d\u0435\u0439\u0448\u0438\u0445, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0445 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432.<\/p>\n<p class=\"for_users_only_msg\">\u0421\u0430\u043c\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0430\u043d\u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0430\u0442 \u0434\u0430 \u0443\u0447\u0430\u0441\u0442\u0432\u0430\u0442 \u0432 \u0430\u043d\u043a\u0435\u0442\u0430\u0442\u0430. <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/auth\/login\/\">\u0412\u043b\u0435\u0437\u0442\u0435<\/a><\/noindex>, \u043c\u043e\u043b\u044f.<\/p>\n<h2 class=\"default-block__polling-title\">\u042f \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0434\u0430\u0432\u043d\u043e \u043d\u0430 \u0445\u0430\u0431\u0440\u0435, \u0438 \u043c\u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0437\u043d\u0430\u0442\u044c, \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0430 \u043a\u0430\u043a\u0438\u0435 \u0442\u0435\u043c\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0431\u044b \u0432\u044b \u0432\u0438\u0434\u0435\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435?<\/h2>\n<ul class=\"content-list content-list_polling\">\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b(\u0414\u041f, \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u044f, \u0441\u0436\u0430\u0442\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0442. \u0434.)<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    \u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u0438<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 android-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 Java<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 web-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 Java<\/p>\n<\/li>\n<\/ul>\n<p>    \u041f\u0440\u043e\u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b\u0438 2 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u043b\u0441\u044f 1 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c.<br \/>\n<br \/>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a: habr.com<\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u041f\u0440\u0435\u043b\u044e\u0434\u0438\u044f \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u043c \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u043c \u043f\u043e\u0438\u0441\u043a\u0430. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0434\u0435\u043b\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u044e \u043f\u0440\u043e \u0441\u0436\u0430\u0442\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430. \u0422\u0430\u043c \u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043e\u0431\u0440\u0430\u0449\u0430\u043b \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0434\u0435\u0440\u0435\u0432\u044c\u044f, \u0438\u0431\u043e \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u043e\u0438\u0441\u043a\u0430, \u0432\u0441\u0442\u0430\u0432\u043a\u0438, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043d\u0435 \u0431\u044b\u043b\u0438 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b. \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u043e \u0434\u0435\u0440\u0435\u0432\u044c\u044f. \u041f\u043e\u0436\u0430\u043b\u0443\u0439, \u043d\u0430\u0447\u043d\u0435\u043c. \u0414\u0435\u0440\u0435\u0432\u043e \u2014 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0438\u0437 \u0443\u0437\u043b\u043e\u0432, \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0431\u0440\u0430\u043c\u0438. \u041c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0434\u0435\u0440\u0435\u0432\u043e \u2014 [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":22528,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-30530","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u041f\u0440\u0435\u043b\u044e\u0434\u0438\u044f \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u043c \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u043c \u043f\u043e\u0438\u0441\u043a\u0430. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0434\u0435\u043b\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u044e \u043f\u0440\u043e \u0441\u0436\u0430\u0442\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430. \u0422\u0430\u043c \u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043e\u0431\u0440\u0430\u0449\u0430\u043b \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0434\u0435\u0440\u0435\u0432\u044c\u044f, \u0438\u0431\u043e \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u043e\u0438\u0441\u043a\u0430, \u0432\u0441\u0442\u0430\u0432\u043a\u0438, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043d\u0435 \u0431\u044b\u043b\u0438 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b. \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u043e \u0434\u0435\u0440\u0435\u0432\u044c\u044f. \u041f\u043e\u0436\u0430\u043b\u0443\u0439, \u043d\u0430\u0447\u043d\u0435\u043c. \u0414\u0435\u0440\u0435\u0432\u043e \u2014 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0438\u0437 \u0443\u0437\u043b\u043e\u0432, \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0431\u0440\u0430\u043c\u0438. \u041c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0434\u0435\u0440\u0435\u0432\u043e \u2014\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/bg\/blog\/administrirovanie\/binary-tree-ili-kak-prigotovit-binarnoe-derevo-poiska\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"bg_BG\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47Binary Tree \u0438\u043b\u0438 \u043a\u0430\u043a \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u043f\u043e\u0438\u0441\u043a\u0430 | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u041f\u0440\u0435\u043b\u044e\u0434\u0438\u044f \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u043c \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u043c \u043f\u043e\u0438\u0441\u043a\u0430. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0434\u0435\u043b\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u044e \u043f\u0440\u043e \u0441\u0436\u0430\u0442\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430. \u0422\u0430\u043c \u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043e\u0431\u0440\u0430\u0449\u0430\u043b \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0434\u0435\u0440\u0435\u0432\u044c\u044f, \u0438\u0431\u043e \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u043e\u0438\u0441\u043a\u0430, \u0432\u0441\u0442\u0430\u0432\u043a\u0438, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043d\u0435 \u0431\u044b\u043b\u0438 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b. \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u043e \u0434\u0435\u0440\u0435\u0432\u044c\u044f. \u041f\u043e\u0436\u0430\u043b\u0443\u0439, \u043d\u0430\u0447\u043d\u0435\u043c. \u0414\u0435\u0440\u0435\u0432\u043e \u2014 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0438\u0437 \u0443\u0437\u043b\u043e\u0432, \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0431\u0440\u0430\u043c\u0438. \u041c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0434\u0435\u0440\u0435\u0432\u043e \u2014\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/bg\/blog\/administrirovanie\/binary-tree-ili-kak-prigotovit-binarnoe-derevo-poiska\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-10-31T18:36:01+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-10-31T18:36:01+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Binary Tree \u0438\u043b\u0438 \u043a\u0430\u043a \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u043f\u043e\u0438\u0441\u043a\u0430 | ProHoster","description":"\u041f\u0440\u0435\u043b\u044e\u0434\u0438\u044f \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u043c \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u043c \u043f\u043e\u0438\u0441\u043a\u0430. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0434\u0435\u043b\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u044e \u043f\u0440\u043e \u0441\u0436\u0430\u0442\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430. \u0422\u0430\u043c \u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043e\u0431\u0440\u0430\u0449\u0430\u043b \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0434\u0435\u0440\u0435\u0432\u044c\u044f, \u0438\u0431\u043e \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u043e\u0438\u0441\u043a\u0430, \u0432\u0441\u0442\u0430\u0432\u043a\u0438, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043d\u0435 \u0431\u044b\u043b\u0438 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b. \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u043e \u0434\u0435\u0440\u0435\u0432\u044c\u044f. \u041f\u043e\u0436\u0430\u043b\u0443\u0439, \u043d\u0430\u0447\u043d\u0435\u043c. \u0414\u0435\u0440\u0435\u0432\u043e \u2014 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0438\u0437 \u0443\u0437\u043b\u043e\u0432, \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0431\u0440\u0430\u043c\u0438. \u041c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0434\u0435\u0440\u0435\u0432\u043e \u2014","canonical_url":"https:\/\/prohoster.info\/bg\/blog\/administrirovanie\/binary-tree-ili-kak-prigotovit-binarnoe-derevo-poiska","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"bg_BG","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47Binary Tree \u0438\u043b\u0438 \u043a\u0430\u043a \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u043f\u043e\u0438\u0441\u043a\u0430 | ProHoster","og:description":"\u041f\u0440\u0435\u043b\u044e\u0434\u0438\u044f \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u043c \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u043c \u043f\u043e\u0438\u0441\u043a\u0430. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0434\u0435\u043b\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u044e \u043f\u0440\u043e \u0441\u0436\u0430\u0442\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430. \u0422\u0430\u043c \u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043e\u0431\u0440\u0430\u0449\u0430\u043b \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0434\u0435\u0440\u0435\u0432\u044c\u044f, \u0438\u0431\u043e \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u043e\u0438\u0441\u043a\u0430, \u0432\u0441\u0442\u0430\u0432\u043a\u0438, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043d\u0435 \u0431\u044b\u043b\u0438 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b. \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u043e \u0434\u0435\u0440\u0435\u0432\u044c\u044f. \u041f\u043e\u0436\u0430\u043b\u0443\u0439, \u043d\u0430\u0447\u043d\u0435\u043c. \u0414\u0435\u0440\u0435\u0432\u043e \u2014 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0438\u0437 \u0443\u0437\u043b\u043e\u0432, \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0431\u0440\u0430\u043c\u0438. \u041c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0434\u0435\u0440\u0435\u0432\u043e \u2014","og:url":"https:\/\/prohoster.info\/bg\/blog\/administrirovanie\/binary-tree-ili-kak-prigotovit-binarnoe-derevo-poiska","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-10-31T18:36:01+00:00","article:modified_time":"2019-10-31T18:36:01+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"30530","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-01-21 01:39:20","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-03-01 03:33:27","updated":"2026-01-21 01:39:20","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/bg\/wp-json\/wp\/v2\/posts\/30530","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/bg\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/bg\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/bg\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/bg\/wp-json\/wp\/v2\/comments?post=30530"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/bg\/wp-json\/wp\/v2\/posts\/30530\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/bg\/wp-json\/wp\/v2\/media\/22528"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/bg\/wp-json\/wp\/v2\/media?parent=30530"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/bg\/wp-json\/wp\/v2\/categories?post=30530"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/bg\/wp-json\/wp\/v2\/tags?post=30530"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}