{"id":73134,"date":"2026-02-07T07:49:52","date_gmt":"2026-02-06T23:49:52","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/73134.html"},"modified":"2026-02-07T07:49:52","modified_gmt":"2026-02-06T23:49:52","slug":"%e5%b9%b3%e8%a1%a1%e4%ba%8c%e5%8f%89%e6%90%9c%e7%b4%a2%e6%a0%91%ef%bc%88balanced-bst%ef%bc%89%e5%85%a8%e9%9d%a2%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/73134.html","title":{"rendered":"\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811\uff08Balanced BST\uff09\u5168\u9762\u8be6\u89e3"},"content":{"rendered":"<h2>\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811\uff08Balanced BST\uff09\u5168\u9762\u8be6\u89e3<\/h2>\n<h3>\u4e00\u3001\u5f15\u8a00\uff1a\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u56f0\u5883\u4e0e\u5e73\u8861\u6811\u7684\u8bde\u751f<\/h3>\n<p>\u5728\u8ba1\u7b97\u673a\u79d1\u5b66\u7684\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u9886\u57df\uff0c\u4e8c\u53c9\u641c\u7d22\u6811\uff08Binary Search Tree, BST\uff09\u662f\u4e00\u79cd\u57fa\u7840\u4e14\u6838\u5fc3\u7684\u6570\u636e\u7ed3\u6784\uff0c\u5b83\u4e3a\u6570\u636e\u7684\u67e5\u627e\u3001\u63d2\u5165\u3001\u5220\u9664\u64cd\u4f5c\u63d0\u4f9b\u4e86\u4e00\u79cd\u9ad8\u6548\u7684\u7ec4\u7ec7\u65b9\u5f0f\u3002\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u6838\u5fc3\u6027\u8d28\u53ef\u4ee5\u6982\u62ec\u4e3a\u4e09\u70b9\uff1a<\/p>\n<li>\u5bf9\u4e8e\u4efb\u610f\u4e00\u4e2a\u8282\u70b9\uff0c\u5176\u5de6\u5b50\u6811\u4e2d\u6240\u6709\u8282\u70b9\u7684\u952e\u503c\u90fd\u5c0f\u4e8e\u8be5\u8282\u70b9\u7684\u952e\u503c\uff1b<\/li>\n<li>\u5bf9\u4e8e\u4efb\u610f\u4e00\u4e2a\u8282\u70b9\uff0c\u5176\u53f3\u5b50\u6811\u4e2d\u6240\u6709\u8282\u70b9\u7684\u952e\u503c\u90fd\u5927\u4e8e\u8be5\u8282\u70b9\u7684\u952e\u503c\uff1b<\/li>\n<li>\u5de6\u53f3\u5b50\u6811\u672c\u8eab\u4e5f\u5fc5\u987b\u662f\u4e00\u68f5\u4e8c\u53c9\u641c\u7d22\u6811\uff0c\u4e14\u901a\u5e38\u4e0d\u5141\u8bb8\u5b58\u5728\u91cd\u590d\u952e\u503c\uff08\u7279\u6b8a\u4e1a\u52a1\u573a\u666f\u53ef\u901a\u8fc7\u6269\u5c55\u8282\u70b9\u5c5e\u6027\u652f\u6301\u91cd\u590d\u6570\u636e\uff09\u3002<\/li>\n<p>\u5728\u7406\u60f3\u60c5\u51b5\u4e0b\uff0c\u4e8c\u53c9\u641c\u7d22\u6811\u5448\u73b0\u5b8c\u5168\u4e8c\u53c9\u6811\u7684\u5f62\u6001\uff0c\u6b64\u65f6\u6811\u7684\u9ad8\u5ea6\u4e3a <span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">O(log\u2061n)O(\\\\log n)<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 1em;vertical-align: -0.25em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0278em\">O<\/span><span class=\"mopen\">(<\/span><span class=\"mop\">lo<span style=\"margin-right: 0.0139em\">g<\/span><\/span><span class=\"mspace\" style=\"margin-right: 0.1667em\"><\/span><span class=\"mord mathnormal\">n<\/span><span class=\"mclose\">)<\/span><\/span><\/span><\/span><\/span>\uff08\u5176\u4e2d <span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">nn<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.4306em\"><\/span><span class=\"mord mathnormal\">n<\/span><\/span><\/span><\/span><\/span> \u4e3a\u6811\u4e2d\u8282\u70b9\u7684\u603b\u6570\uff09\uff0c\u67e5\u627e\u3001\u63d2\u5165\u3001\u5220\u9664\u8fd9\u4e09\u5927\u6838\u5fc3\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e5f\u5747\u4e3a <span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">O(log\u2061n)O(\\\\log n)<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 1em;vertical-align: -0.25em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0278em\">O<\/span><span class=\"mopen\">(<\/span><span class=\"mop\">lo<span style=\"margin-right: 0.0139em\">g<\/span><\/span><span class=\"mspace\" style=\"margin-right: 0.1667em\"><\/span><span class=\"mord mathnormal\">n<\/span><span class=\"mclose\">)<\/span><\/span><\/span><\/span><\/span>\u3002\u8fd9\u4e00\u6548\u7387\u5728\u5927\u89c4\u6a21\u6570\u636e\u5904\u7406\u573a\u666f\u4e2d\u81f3\u5173\u91cd\u8981\uff0c\u56e0\u4e3a\u5b83\u610f\u5473\u7740\u6570\u636e\u91cf\u7ffb\u500d\u65f6\uff0c\u64cd\u4f5c\u7684\u8017\u65f6\u4ec5\u4f1a\u5c0f\u5e45\u589e\u52a0\uff0c\u80fd\u591f\u5f88\u597d\u5730\u652f\u6491\u9ad8\u5e76\u53d1\u3001\u5927\u6570\u636e\u91cf\u7684\u4e1a\u52a1\u9700\u6c42\u3002<\/p>\n<p>\u4f46\u73b0\u5b9e\u573a\u666f\u4e2d\uff0c\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u8868\u73b0\u5374\u6781\u6613\u51fa\u73b0\u201c\u6ed1\u94c1\u5362\u201d\u2014\u2014\u5f53\u6211\u4eec\u4f9d\u6b21\u63d2\u5165\u4e00\u7ec4\u6709\u5e8f\u6570\u636e\uff08\u65e0\u8bba\u662f\u5347\u5e8f\u5982 1\u30012\u30013\u30014\u30015\u30016\u30017\uff0c\u8fd8\u662f\u964d\u5e8f\u5982 7\u30016\u30015\u30014\u30013\u30012\u30011\uff09\u65f6\uff0c\u4e8c\u53c9\u641c\u7d22\u6811\u4f1a\u76f4\u63a5\u9000\u5316\u4e3a\u4e00\u6761\u5355\u94fe\u3002\u6b64\u65f6\u6811\u7684\u9ad8\u5ea6\u4e0d\u518d\u662f\u5bf9\u6570\u7ea7\uff0c\u800c\u662f\u53d8\u4e3a <span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">O(n)O(n)<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 1em;vertical-align: -0.25em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0278em\">O<\/span><span class=\"mopen\">(<\/span><span class=\"mord mathnormal\">n<\/span><span class=\"mclose\">)<\/span><\/span><\/span><\/span><\/span>\uff0c\u6240\u6709\u6838\u5fc3\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e5f\u968f\u4e4b\u9000\u5316\u4e3a <span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">O(n)O(n)<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 1em;vertical-align: -0.25em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0278em\">O<\/span><span class=\"mopen\">(<\/span><span class=\"mord mathnormal\">n<\/span><span class=\"mclose\">)<\/span><\/span><\/span><\/span><\/span>\u3002\u8fd9\u4e00\u60c5\u51b5\u4e0b\uff0c\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u6027\u80fd\u4e0d\u4ec5\u65e0\u6cd5\u4e0e\u54c8\u5e0c\u8868\u7b49\u9ad8\u6548\u6570\u636e\u7ed3\u6784\u6297\u8861\uff0c\u751a\u81f3\u4e0e\u666e\u901a\u7684\u6570\u7ec4\u3001\u94fe\u8868\u76f8\u6bd4\u4e5f\u6beb\u65e0\u4f18\u52bf\u53ef\u8a00\uff0c\u53cd\u800c\u5728\u5220\u9664\u64cd\u4f5c\u4e2d\u56e0\u4e3a\u9700\u8981\u7ef4\u62a4\u8282\u70b9\u7684\u7236\u5b50\u6307\u9488\u5173\u7cfb\uff0c\u663e\u5f97\u66f4\u4e3a\u7e41\u7410\u548c\u4f4e\u6548\u3002<\/p>\n<p>\u4e3e\u4e00\u4e2a\u5177\u4f53\u7684\u573a\u666f\u4f8b\u5b50\uff1a\u5047\u8bbe\u6211\u4eec\u9700\u8981\u7528\u4e8c\u53c9\u641c\u7d22\u6811\u5b58\u50a8100\u4e07\u4e2a\u6709\u5e8f\u7528\u6237ID\uff0c\u82e5\u76f4\u63a5\u4f9d\u6b21\u63d2\u5165\uff0c\u6811\u4f1a\u9000\u5316\u4e3a\u5355\u94fe\u3002\u6b64\u65f6\u8981\u67e5\u627e\u6700\u540e\u4e00\u4e2a\u7528\u6237ID\uff0c\u9700\u8981\u4ece\u6839\u8282\u70b9\u5f00\u59cb\u9010\u4e2a\u904d\u5386\uff0c\u76f4\u5230\u94fe\u5c3e\uff0c\u9700\u8981\u6267\u884c100\u4e07\u6b21\u6bd4\u8f83\u64cd\u4f5c\uff0c\u8fd9\u5728\u5b9e\u65f6\u54cd\u5e94\u7684\u4e1a\u52a1\u7cfb\u7edf\u4e2d\u662f\u5b8c\u5168\u65e0\u6cd5\u63a5\u53d7\u7684\u3002<\/p>\n<p>\u4e3a\u4e86\u89e3\u51b3\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u201c\u5931\u8861\u201d\u75db\u70b9\uff0c\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811\uff08Balanced Binary Search Tree\uff0c\u7b80\u79f0\u5e73\u8861\u6811\uff09\u5e94\u8fd0\u800c\u751f\u3002\u5e73\u8861\u6811\u5e76\u4e0d\u662f\u4e00\u79cd\u5355\u4e00\u7684\u6570\u636e\u7ed3\u6784\uff0c\u800c\u662f\u4e00\u4e2a\u5177\u6709\u5171\u540c\u7279\u6027\u7684\u201c\u6570\u636e\u7ed3\u6784\u5bb6\u65cf\u201d\uff0c\u5176\u6838\u5fc3\u8bbe\u8ba1\u601d\u60f3\u662f\uff1a\u5728\u4e25\u683c\u9075\u5b88\u4e8c\u53c9\u641c\u7d22\u6811\u6838\u5fc3\u6027\u8d28\u7684\u524d\u63d0\u4e0b\uff0c\u901a\u8fc7\u4e00\u5957\u7279\u5b9a\u7684\u81ea\u8c03\u6574\u673a\u5236\uff08\u6838\u5fc3\u4e3a\u201c\u65cb\u8f6c\u64cd\u4f5c\u201d\uff0c\u8f85\u4ee5\u8282\u70b9\u989c\u8272\u6807\u8bb0\u3001\u4f18\u5148\u7ea7\u5206\u914d\u7b49\u8f85\u52a9\u624b\u6bb5\uff09\uff0c\u5728\u6bcf\u6b21\u63d2\u5165\u3001\u5220\u9664\u64cd\u4f5c\u5bfc\u81f4\u6811\u7684\u5f62\u6001\u53d1\u751f\u53d8\u5316\u540e\uff0c\u4e3b\u52a8\u68c0\u6d4b\u6811\u7684\u5e73\u8861\u72b6\u6001\uff0c\u82e5\u53d1\u73b0\u5931\u8861\u5219\u7acb\u5373\u8fdb\u884c\u7ed3\u6784\u8c03\u6574\uff0c\u59cb\u7ec8\u5c06\u6811\u7684\u9ad8\u5ea6\u63a7\u5236\u5728 <span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">O(log\u2061n)O(\\\\log n)<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 1em;vertical-align: -0.25em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0278em\">O<\/span><span class=\"mopen\">(<\/span><span class=\"mop\">lo<span style=\"margin-right: 0.0139em\">g<\/span><\/span><span class=\"mspace\" style=\"margin-right: 0.1667em\"><\/span><span class=\"mord mathnormal\">n<\/span><span class=\"mclose\">)<\/span><\/span><\/span><\/span><\/span> \u8303\u56f4\u5185\uff0c\u4ece\u800c\u4fdd\u8bc1\u67e5\u627e\u3001\u63d2\u5165\u3001\u5220\u9664\u7b49\u6838\u5fc3\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u7a33\u5b9a\u5728 <span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">O(log\u2061n)O(\\\\log n)<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 1em;vertical-align: -0.25em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0278em\">O<\/span><span class=\"mopen\">(<\/span><span class=\"mop\">lo<span style=\"margin-right: 0.0139em\">g<\/span><\/span><span class=\"mspace\" style=\"margin-right: 0.1667em\"><\/span><span class=\"mord mathnormal\">n<\/span><span class=\"mclose\">)<\/span><\/span><\/span><\/span><\/span>\uff0c\u4ece\u6839\u672c\u4e0a\u907f\u514d\u4e86\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u9000\u5316\u95ee\u9898\u3002<\/p>\n<p>\u5e73\u8861\u6811\u5bb6\u65cf\u4e2d\uff0c\u6700\u7ecf\u5178\u3001\u6700\u5177\u4ee3\u8868\u6027\u7684\u6210\u5458\u5305\u62ec\u4ee5\u4e0b\u56db\u7c7b\uff0c\u5b83\u4eec\u5404\u81ea\u6709\u7740\u4e0d\u540c\u7684\u5e73\u8861\u7b56\u7565\u3001\u6027\u80fd\u7279\u70b9\u548c\u5e94\u7528\u573a\u666f\uff1a<\/p>\n<li>AVL\u6811\uff1a\u6700\u65e9\u8bde\u751f\u7684\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811\uff081962\u5e74\u7531Adelson-Velsky\u548cLandis\u4e24\u4f4d\u79d1\u5b66\u5bb6\u63d0\u51fa\uff0c\u56e0\u6b64\u4ee5\u4e8c\u4eba\u540d\u5b57\u547d\u540d\uff09\uff0c\u5c5e\u4e8e\u4e25\u683c\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811\u3002\u5b83\u8981\u6c42\u6811\u4e2d\u4efb\u610f\u4e00\u4e2a\u8282\u70b9\u7684\u5de6\u53f3\u5b50\u6811\u9ad8\u5ea6\u5dee\uff08\u79f0\u4e3a\u201c\u5e73\u8861\u56e0\u5b50\u201d\uff09\u7684\u7edd\u5bf9\u503c\u4e0d\u8d85\u8fc71\uff0c\u8fd9\u79cd\u4e25\u683c\u7684\u5e73\u8861\u8981\u6c42\u4fdd\u8bc1\u4e86\u6811\u7684\u9ad8\u5ea6\u5c3d\u53ef\u80fd\u4f4e\uff0c\u67e5\u627e\u6548\u7387\u6781\u9ad8\uff0c\u4f46\u4e5f\u5bfc\u81f4\u63d2\u5165\u548c\u5220\u9664\u64cd\u4f5c\u65f6\u7684\u8c03\u6574\u6b21\u6570\u8f83\u591a\uff0c\u6548\u7387\u76f8\u5bf9\u7565\u4f4e\u3002<\/li>\n<li>\u7ea2\u9ed1\u6811\uff1a\u4e00\u79cd\u5f31\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811\uff081972\u5e74\u7531Rudolf Bayer\u9996\u6b21\u63d0\u51fa\uff0c\u6700\u521d\u540d\u4e3a\u201c\u5bf9\u79f0\u4e8c\u53c9B\u6811\u201d\uff0c1978\u5e74\u7531Leonidas J. Guibas\u548cRobert Sedgewick\u4f18\u5316\u5e76\u547d\u540d\u4e3a\u7ea2\u9ed1\u6811\uff09\u3002\u5b83\u4e0d\u8ffd\u6c42\u4e25\u683c\u7684\u5e73\u8861\uff0c\u4ec5\u901a\u8fc7\u7ef4\u62a4\u8282\u70b9\u7684\u7ea2\u3001\u9ed1\u4e24\u79cd\u989c\u8272\uff0c\u4ee5\u53ca\u4e94\u6761\u6838\u5fc3\u6027\u8d28\uff0c\u4fdd\u8bc1\u4ece\u6839\u8282\u70b9\u5230\u4efb\u610f\u53f6\u5b50\u8282\u70b9\u7684\u6700\u957f\u8def\u5f84\u4e0d\u8d85\u8fc7\u6700\u77ed\u8def\u5f84\u76842\u500d\u3002\u8fd9\u79cd\u5bbd\u677e\u7684\u5e73\u8861\u8981\u6c42\u4f7f\u5f97\u7ea2\u9ed1\u6811\u5728\u63d2\u5165\u3001\u5220\u9664\u64cd\u4f5c\u4e2d\u7684\u8c03\u6574\u6b21\u6570\u66f4\u5c11\uff0c\u6574\u4f53\u6548\u7387\u66f4\u9ad8\uff0c\u662f\u5de5\u7a0b\u5b9e\u8df5\u4e2d\u5e94\u7528\u6700\u5e7f\u6cdb\u7684\u5e73\u8861\u6811\uff0c\u4f8b\u5982Java\u7684TreeMap\u548cTreeSet\u3001C++\u7684std::map\u548cstd::set\u3001Linux\u5185\u6838\u7684\u8fdb\u7a0b\u8c03\u5ea6\u5668\u3001Redis\u7684\u6709\u5e8f\u96c6\u5408\uff08zset\uff09\u5e95\u5c42\u5b9e\u73b0\u7b49\uff0c\u90fd\u91c7\u7528\u4e86\u7ea2\u9ed1\u6811\u3002<\/li>\n<li>Splay\u6811\uff1a\u4e00\u79cd\u81ea\u9002\u5e94\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811\uff081985\u5e74\u7531Daniel Sleator\u548cRobert Tarjan\u63d0\u51fa\uff09\u3002\u5b83\u4e0d\u4f9d\u8d56\u4e8e\u5e73\u8861\u56e0\u5b50\u6216\u8282\u70b9\u989c\u8272\u6765\u7ef4\u6301\u5e73\u8861\uff0c\u800c\u662f\u901a\u8fc7\u201c\u4f38\u5c55\u64cd\u4f5c\u201d\u5c06\u6700\u8fd1\u8bbf\u95ee\uff08\u67e5\u627e\u3001\u63d2\u5165\u3001\u5220\u9664\uff09\u7684\u8282\u70b9\u8c03\u6574\u5230\u6811\u7684\u6839\u8282\u70b9\u4f4d\u7f6e\u3002\u8fd9\u79cd\u81ea\u9002\u5e94\u7279\u6027\u4f7f\u5f97Splay\u6811\u5728\u9891\u7e41\u8bbf\u95ee\u5c11\u91cf\u6570\u636e\u7684\u573a\u666f\u4e2d\u8868\u73b0\u4f18\u5f02\uff0c\u56e0\u4e3a\u88ab\u9891\u7e41\u8bbf\u95ee\u7684\u8282\u70b9\u4f1a\u59cb\u7ec8\u9760\u8fd1\u6839\u8282\u70b9\uff0c\u540e\u7eed\u8bbf\u95ee\u7684\u8017\u65f6\u4f1a\u5927\u5e45\u964d\u4f4e\uff0c\u4f46\u5728\u6700\u574f\u60c5\u51b5\u4e0b\uff0c\u5176\u64cd\u4f5c\u65f6\u95f4\u590d\u6742\u5ea6\u4ecd\u53ef\u80fd\u8fbe\u5230 <span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">O(n)O(n)<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 1em;vertical-align: -0.25em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0278em\">O<\/span><span class=\"mopen\">(<\/span><span class=\"mord mathnormal\">n<\/span><span class=\"mclose\">)<\/span><\/span><\/span><\/span><\/span>\uff0c\u56e0\u6b64\u4e0d\u9002\u5408\u5bf9\u7a33\u5b9a\u6027\u8981\u6c42\u6781\u9ad8\u7684\u573a\u666f\u3002<\/li>\n<li>Treap\uff1a\u4e00\u79cd\u7ed3\u5408\u4e86\u4e8c\u53c9\u641c\u7d22\u6811\u548c\u5806\u7684\u7279\u6027\u7684\u5e73\u8861\u6811\uff08\u540d\u79f0\u7531\u201cTree\u201d\u548c\u201cHeap\u201d\u7ec4\u5408\u800c\u6765\uff09\u3002\u5b83\u4e3a\u6bcf\u4e2a\u8282\u70b9\u968f\u673a\u5206\u914d\u4e00\u4e2a\u4f18\u5148\u7ea7\uff0c\u5728\u7ef4\u6301\u4e8c\u53c9\u641c\u7d22\u6811\u952e\u503c\u987a\u5e8f\u7684\u540c\u65f6\uff0c\u4fdd\u8bc1\u6bcf\u4e2a\u8282\u70b9\u7684\u4f18\u5148\u7ea7\u90fd\u4e0d\u5c0f\u4e8e\u5176\u5de6\u53f3\u5b69\u5b50\u7684\u4f18\u5148\u7ea7\uff08\u5373\u6ee1\u8db3\u5806\u7684\u6027\u8d28\uff09\u3002\u901a\u8fc7\u968f\u673a\u4f18\u5148\u7ea7\u7684\u5f15\u5165\uff0cTreap\u80fd\u591f\u5728\u6982\u7387\u4e0a\u4fdd\u8bc1\u6811\u7684\u5e73\u8861\uff0c\u5176\u5b9e\u73b0\u96be\u5ea6\u8fdc\u4f4e\u4e8eAVL\u6811\u548c\u7ea2\u9ed1\u6811\uff0c\u975e\u5e38\u9002\u5408\u5165\u95e8\u5b66\u4e60\u8005\u7406\u89e3\u5e73\u8861\u6811\u7684\u6838\u5fc3\u601d\u60f3\u3002<\/li>\n<p>\u672c\u6587\u5c06\u4ee5AVL\u6811\u4e3a\u6838\u5fc3\u8bb2\u89e3\u5bf9\u8c61\uff08\u56e0\u5176\u4e25\u683c\u5e73\u8861\u7684\u7279\u6027\uff0c\u6700\u6613\u5e2e\u52a9\u8bfb\u8005\u7406\u89e3\u5e73\u8861\u6811\u7684\u6838\u5fc3\u601d\u60f3\u3001\u5e73\u8861\u5224\u5b9a\u6807\u51c6\u548c\u81ea\u8c03\u6574\u673a\u5236\uff09\uff0c\u540c\u65f6\u8f85\u4ee5\u7ea2\u9ed1\u6811\u7684\u6838\u5fc3\u6982\u5ff5\u548c\u5e94\u7528\u573a\u666f\u4ecb\u7ecd\uff0c\u5168\u9762\u8be6\u89e3\u5e73\u8861\u6811\u7684\u5b9a\u4e49\u3001\u6838\u5fc3\u6027\u8d28\u3001\u5e73\u8861\u5224\u5b9a\u65b9\u6cd5\u3001\u81ea\u8c03\u6574\u64cd\u4f5c\u3001\u6838\u5fc3\u6d41\u7a0b\u4ee5\u53ca\u5b9e\u9645\u5e94\u7528\uff0c\u5e2e\u52a9\u8bfb\u8005\u4ece\u7406\u8bba\u5230\u8ba4\u77e5\uff0c\u5f7b\u5e95\u638c\u63e1\u5e73\u8861\u6811\u7684\u6838\u5fc3\u903b\u8f91\u3002<\/p>\n<h3>\u4e8c\u3001\u5e73\u8861\u6811\u7684\u6838\u5fc3\u57fa\u7840\uff1aAVL\u6811\u7684\u5b9a\u4e49\u4e0e\u5e73\u8861\u5224\u5b9a<\/h3>\n<h4>2.1 AVL\u6811\u7684\u4e25\u683c\u5b9a\u4e49<\/h4>\n<p>AVL\u6811\u662f\u4e00\u79cd\u4e25\u683c\u5e73\u8861\u7684\u4e8c\u53c9\u641c\u7d22\u6811\uff0c\u5b83\u5728\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u57fa\u7840\u4e0a\uff0c\u589e\u52a0\u4e86\u989d\u5916\u7684\u5e73\u8861\u7ea6\u675f\u6761\u4ef6\uff1a\u5bf9\u4e8e\u6811\u4e2d\u7684\u4efb\u610f\u4e00\u4e2a\u8282\u70b9\uff0c\u5176\u5de6\u5b50\u6811\u7684\u9ad8\u5ea6\u4e0e\u53f3\u5b50\u6811\u7684\u9ad8\u5ea6\u4e4b\u5dee\uff08\u79f0\u4e3a\u201c\u5e73\u8861\u56e0\u5b50\u201d\uff09\u7684\u7edd\u5bf9\u503c\u4e0d\u8d85\u8fc71\u3002<\/p>\n<p>\u8981\u7406\u89e3\u8fd9\u4e00\u5b9a\u4e49\uff0c\u6211\u4eec\u9996\u5148\u9700\u8981\u660e\u786e\u4e24\u4e2a\u6838\u5fc3\u6982\u5ff5\uff1a\u8282\u70b9\u7684\u9ad8\u5ea6\u548c\u5e73\u8861\u56e0\u5b50\u3002<\/p>\n<h5>2.1.1 \u8282\u70b9\u7684\u9ad8\u5ea6<\/h5>\n<p>\u5728AVL\u6811\u4e2d\uff0c\u8282\u70b9\u7684\u9ad8\u5ea6\u5b9a\u4e49\u4e3a\uff1a\u4ece\u8be5\u8282\u70b9\u5230\u5176\u6700\u8fdc\u53f6\u5b50\u8282\u70b9\u7684\u8def\u5f84\u4e0a\u7684\u8282\u70b9\u4e2a\u6570\uff08\u5305\u542b\u8be5\u8282\u70b9\u672c\u8eab\u548c\u53f6\u5b50\u8282\u70b9\uff09\u3002<\/p>\n<p>\u8fd9\u91cc\u9700\u8981\u6ce8\u610f\u533a\u5206\u201c\u8282\u70b9\u7684\u9ad8\u5ea6\u201d\u548c\u201c\u8282\u70b9\u7684\u6df1\u5ea6\u201d\uff0c\u8fd9\u4e24\u4e2a\u6982\u5ff5\u5728\u6570\u636e\u7ed3\u6784\u4e2d\u6781\u6613\u6df7\u6dc6\uff1a<\/p>\n<ul>\n<li>\u8282\u70b9\u7684\u9ad8\u5ea6\uff1a\u4ece\u5f53\u524d\u8282\u70b9\u5411\u4e0b\u5230\u6700\u8fdc\u53f6\u5b50\u8282\u70b9\u7684\u8def\u5f84\u957f\u5ea6\uff0c\u662f\u4e00\u4e2a\u201c\u81ea\u4e0b\u800c\u4e0a\u201d\u7684\u7edf\u8ba1\u6982\u5ff5\uff1b<\/li>\n<li>\u8282\u70b9\u7684\u6df1\u5ea6\uff1a\u4ece\u6839\u8282\u70b9\u5411\u4e0a\u5230\u5f53\u524d\u8282\u70b9\u7684\u8def\u5f84\u957f\u5ea6\uff0c\u662f\u4e00\u4e2a\u201c\u81ea\u4e0a\u800c\u4e0b\u201d\u7684\u7edf\u8ba1\u6982\u5ff5\uff0c\u6839\u8282\u70b9\u7684\u6df1\u5ea6\u4e3a1\uff08\u62160\uff0c\u4e0d\u540c\u5b9a\u4e49\u4f53\u7cfb\u7565\u6709\u5dee\u5f02\uff0c\u672c\u6587\u7edf\u4e00\u91c7\u7528\u8282\u70b9\u4e2a\u6570\u7edf\u8ba1\uff0c\u6839\u8282\u70b9\u6df1\u5ea6\u4e3a1\uff09\u3002<\/li>\n<\/ul>\n<p>\u5bf9\u4e8eAVL\u6811\u4e2d\u7684\u8282\u70b9\uff0c\u6709\u4e24\u4e2a\u7279\u6b8a\u60c5\u51b5\u9700\u8981\u660e\u786e\uff1a<\/p>\n<li>\u53f6\u5b50\u8282\u70b9\uff08\u5373\u6ca1\u6709\u5de6\u3001\u53f3\u5b69\u5b50\u7684\u8282\u70b9\uff09\u7684\u9ad8\u5ea6\u4e3a1\uff0c\u56e0\u4e3a\u5176\u81ea\u8eab\u5c31\u662f\u6700\u8fdc\u7684\u53f6\u5b50\u8282\u70b9\uff0c\u8def\u5f84\u4e0a\u4ec5\u5305\u542b\u81ea\u8eab\uff1b<\/li>\n<li>\u7a7a\u8282\u70b9\uff08\u5373\u8282\u70b9\u7684\u5de6\u5b69\u5b50\u6216\u53f3\u5b69\u5b50\u4e0d\u5b58\u5728\u65f6\uff0c\u5bf9\u5e94\u7684\u7a7a\u6307\u9488\uff09\u7684\u9ad8\u5ea6\u4e3a0\uff0c\u8fd9\u662f\u4e00\u4e2a\u4eba\u4e3a\u89c4\u5b9a\u7684\u8f85\u52a9\u503c\uff0c\u7528\u4e8e\u65b9\u4fbf\u8ba1\u7b97\u53f6\u5b50\u8282\u70b9\u7684\u5e73\u8861\u56e0\u5b50\uff08\u53f6\u5b50\u8282\u70b9\u7684\u5de6\u53f3\u5b69\u5b50\u5747\u4e3a\u7a7a\u8282\u70b9\uff0c\u9ad8\u5ea6\u4e3a0\uff0c\u5e73\u8861\u56e0\u5b50\u4e3a0\uff0c\u6ee1\u8db3\u5e73\u8861\u8981\u6c42\uff09\u3002<\/li>\n<p>\u4e3e\u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\uff1a\u4e00\u68f5\u4ec5\u6709\u6839\u8282\u70b9\u7684AVL\u6811\uff0c\u6839\u8282\u70b9\u7684\u9ad8\u5ea6\u4e3a1\uff1b\u82e5\u6839\u8282\u70b9\u6709\u4e00\u4e2a\u5de6\u5b69\u5b50\uff08\u53f6\u5b50\u8282\u70b9\uff09\uff0c\u5219\u6839\u8282\u70b9\u7684\u9ad8\u5ea6\u4e3a2\uff0c\u5de6\u5b69\u5b50\u7684\u9ad8\u5ea6\u4e3a1\uff0c\u6839\u8282\u70b9\u7684\u53f3\u5b69\u5b50\u4e3a\u7a7a\u8282\u70b9\uff0c\u9ad8\u5ea6\u4e3a0\u3002<\/p>\n<h5>2.1.2 \u5e73\u8861\u56e0\u5b50<\/h5>\n<p>AVL\u6811\u4e2d\uff0c\u8282\u70b9\u7684\u5e73\u8861\u56e0\u5b50\uff08Balance Factor\uff0c\u7b80\u79f0BF\uff09\u7684\u5b9a\u4e49\u4e3a\uff1a\u8282\u70b9\u7684\u5de6\u5b50\u6811\u9ad8\u5ea6\u51cf\u53bb\u53f3\u5b50\u6811\u9ad8\u5ea6\uff0c\u5373\uff1a <span class=\"katex--display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\">BF(node)=height(left_subtree)\u2212height(right_subtree)BF(node) = height(left\\\\_subtree) &#8211; height(right\\\\_subtree)<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 1em;vertical-align: -0.25em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.1389em\">BF<\/span><span class=\"mopen\">(<\/span><span class=\"mord mathnormal\">n<\/span><span class=\"mord mathnormal\">o<\/span><span class=\"mord mathnormal\">d<\/span><span class=\"mord mathnormal\">e<\/span><span class=\"mclose\">)<\/span><span class=\"mspace\" style=\"margin-right: 0.2778em\"><\/span><span class=\"mrel\">=<\/span><span class=\"mspace\" style=\"margin-right: 0.2778em\"><\/span><\/span><span class=\"base\"><span class=\"strut\" style=\"height: 1.06em;vertical-align: -0.31em\"><\/span><span class=\"mord mathnormal\">h<\/span><span class=\"mord mathnormal\">e<\/span><span class=\"mord mathnormal\">i<\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0359em\">g<\/span><span class=\"mord mathnormal\">h<\/span><span class=\"mord mathnormal\">t<\/span><span class=\"mopen\">(<\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0197em\">l<\/span><span class=\"mord mathnormal\">e<\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.1076em\">f<\/span><span class=\"mord mathnormal\">t<\/span><span class=\"mord\" style=\"margin-right: 0.0278em\">_<\/span><span class=\"mord mathnormal\">s<\/span><span class=\"mord mathnormal\">u<\/span><span class=\"mord mathnormal\">b<\/span><span class=\"mord mathnormal\">t<\/span><span class=\"mord mathnormal\">ree<\/span><span class=\"mclose\">)<\/span><span class=\"mspace\" style=\"margin-right: 0.2222em\"><\/span><span class=\"mbin\">\u2212<\/span><span class=\"mspace\" style=\"margin-right: 0.2222em\"><\/span><\/span><span class=\"base\"><span class=\"strut\" style=\"height: 1.06em;vertical-align: -0.31em\"><\/span><span class=\"mord mathnormal\">h<\/span><span class=\"mord mathnormal\">e<\/span><span class=\"mord mathnormal\">i<\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0359em\">g<\/span><span class=\"mord mathnormal\">h<\/span><span class=\"mord mathnormal\">t<\/span><span class=\"mopen\">(<\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0278em\">r<\/span><span class=\"mord mathnormal\">i<\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0359em\">g<\/span><span class=\"mord mathnormal\">h<\/span><span class=\"mord mathnormal\">t<\/span><span class=\"mord\" style=\"margin-right: 0.0278em\">_<\/span><span class=\"mord mathnormal\">s<\/span><span class=\"mord mathnormal\">u<\/span><span class=\"mord mathnormal\">b<\/span><span class=\"mord mathnormal\">t<\/span><span class=\"mord mathnormal\">ree<\/span><span class=\"mclose\">)<\/span><\/span><\/span><\/span><\/span><\/span><\/p>\n<p>\u6839\u636eAVL\u6811\u7684\u5e73\u8861\u7ea6\u675f\u6761\u4ef6\uff0c\u4efb\u610f\u8282\u70b9\u7684\u5e73\u8861\u56e0\u5b50\u53ea\u80fd\u53d6\u4e09\u4e2a\u503c\uff1a-1\u30010\u30011\u3002\u8fd9\u4e09\u4e2a\u503c\u5bf9\u5e94\u7684\u8282\u70b9\u72b6\u6001\u5206\u522b\u4e3a\uff1a<\/p>\n<li><span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">BF=0BF=0<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.1389em\">BF<\/span><span class=\"mspace\" style=\"margin-right: 0.2778em\"><\/span><span class=\"mrel\">=<\/span><span class=\"mspace\" style=\"margin-right: 0.2778em\"><\/span><\/span><span class=\"base\"><span class=\"strut\" style=\"height: 0.6444em\"><\/span><span class=\"mord\">0<\/span><\/span><\/span><\/span><\/span>\uff1a\u8282\u70b9\u7684\u5de6\u5b50\u6811\u9ad8\u5ea6\u7b49\u4e8e\u53f3\u5b50\u6811\u9ad8\u5ea6\uff0c\u8be5\u8282\u70b9\u5904\u4e8e\u5b8c\u5168\u5e73\u8861\u72b6\u6001\uff0c\u662f\u6700\u4f18\u7684\u8282\u70b9\u5f62\u6001\uff1b<\/li>\n<li><span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">BF=1BF=1<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.1389em\">BF<\/span><span class=\"mspace\" style=\"margin-right: 0.2778em\"><\/span><span class=\"mrel\">=<\/span><span class=\"mspace\" style=\"margin-right: 0.2778em\"><\/span><\/span><span class=\"base\"><span class=\"strut\" style=\"height: 0.6444em\"><\/span><span class=\"mord\">1<\/span><\/span><\/span><\/span><\/span>\uff1a\u8282\u70b9\u7684\u5de6\u5b50\u6811\u9ad8\u5ea6\u6bd4\u53f3\u5b50\u6811\u9ad8\u5ea6\u59271\uff0c\u8be5\u8282\u70b9\u5904\u4e8e\u8f7b\u5fae\u7684\u5de6\u504f\u72b6\u6001\uff0c\u4ecd\u6ee1\u8db3\u5e73\u8861\u8981\u6c42\uff1b<\/li>\n<li><span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">BF=\u22121BF=-1<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.1389em\">BF<\/span><span class=\"mspace\" style=\"margin-right: 0.2778em\"><\/span><span class=\"mrel\">=<\/span><span class=\"mspace\" style=\"margin-right: 0.2778em\"><\/span><\/span><span class=\"base\"><span class=\"strut\" style=\"height: 0.7278em;vertical-align: -0.0833em\"><\/span><span class=\"mord\">\u2212<\/span><span class=\"mord\">1<\/span><\/span><\/span><\/span><\/span>\uff1a\u8282\u70b9\u7684\u53f3\u5b50\u6811\u9ad8\u5ea6\u6bd4\u5de6\u5b50\u6811\u9ad8\u5ea6\u59271\uff0c\u8be5\u8282\u70b9\u5904\u4e8e\u8f7b\u5fae\u7684\u53f3\u504f\u72b6\u6001\uff0c\u4ecd\u6ee1\u8db3\u5e73\u8861\u8981\u6c42\u3002<\/li>\n<p>\u5f53\u67d0\u4e2a\u8282\u70b9\u7684\u5e73\u8861\u56e0\u5b50\u7684\u7edd\u5bf9\u503c\u5927\u4e8e1\uff08\u5373<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">BF\u22652BF\\\\geq2<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.8193em;vertical-align: -0.136em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.1389em\">BF<\/span><span class=\"mspace\" style=\"margin-right: 0.2778em\"><\/span><span class=\"mrel\">\u2265<\/span><span class=\"mspace\" style=\"margin-right: 0.2778em\"><\/span><\/span><span class=\"base\"><span class=\"strut\" style=\"height: 0.6444em\"><\/span><span class=\"mord\">2<\/span><\/span><\/span><\/span><\/span>\u6216<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">BF\u2264\u22122BF\\\\leq-2<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.8193em;vertical-align: -0.136em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.1389em\">BF<\/span><span class=\"mspace\" style=\"margin-right: 0.2778em\"><\/span><span class=\"mrel\">\u2264<\/span><span class=\"mspace\" style=\"margin-right: 0.2778em\"><\/span><\/span><span class=\"base\"><span class=\"strut\" style=\"height: 0.7278em;vertical-align: -0.0833em\"><\/span><span class=\"mord\">\u2212<\/span><span class=\"mord\">2<\/span><\/span><\/span><\/span><\/span>\uff09\u65f6\uff0c\u8bf4\u660e\u8be5\u8282\u70b9\u7684\u5de6\u53f3\u5b50\u6811\u9ad8\u5ea6\u5dee\u8fc7\u5927\uff0c\u6811\u5728\u8be5\u8282\u70b9\u9644\u8fd1\u51fa\u73b0\u4e86\u5931\u8861\uff0c\u6b64\u65f6\u9700\u8981\u901a\u8fc7\u65cb\u8f6c\u64cd\u4f5c\u6765\u8c03\u6574\u6811\u7684\u7ed3\u6784\uff0c\u6062\u590d\u5e73\u8861\u72b6\u6001\u3002<\/p>\n<h4>2.2 AVL\u6811\u7684\u5931\u8861\u7c7b\u578b<\/h4>\n<p>\u5728AVL\u6811\u7684\u63d2\u5165\u6216\u5220\u9664\u64cd\u4f5c\u4e2d\uff0c\u65b0\u8282\u70b9\u7684\u63d2\u5165\u6216\u539f\u6709\u8282\u70b9\u7684\u5220\u9664\u4f1a\u5bfc\u81f4\u90e8\u5206\u8282\u70b9\u7684\u5b50\u6811\u9ad8\u5ea6\u53d1\u751f\u53d8\u5316\uff0c\u8fdb\u800c\u53ef\u80fd\u5bfc\u81f4\u8282\u70b9\u7684\u5e73\u8861\u56e0\u5b50\u8d85\u51fa\u5408\u6cd5\u8303\u56f4\uff0c\u5f15\u53d1\u5931\u8861\u3002\u6839\u636e\u5931\u8861\u8282\u70b9\u7684\u5b50\u6811\u5f62\u6001\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06AVL\u6811\u7684\u5931\u8861\u5206\u4e3a\u56db\u79cd\u57fa\u672c\u7c7b\u578b\uff0c\u8fd9\u56db\u79cd\u7c7b\u578b\u662f\u540e\u7eed\u8fdb\u884c\u65cb\u8f6c\u8c03\u6574\u7684\u57fa\u7840\uff0c\u5fc5\u987b\u51c6\u786e\u7406\u89e3\u548c\u533a\u5206\u3002<\/p>\n<p>\u4e3a\u4e86\u65b9\u4fbf\u63cf\u8ff0\uff0c\u6211\u4eec\u5148\u5b9a\u4e49\u51e0\u4e2a\u5173\u952e\u8282\u70b9\uff1a<\/p>\n<ul>\n<li>\u5931\u8861\u8282\u70b9\uff1a\u8bb0\u4e3a<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">AA<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\">A<\/span><\/span><\/span><\/span><\/span>\uff0c\u5373\u5e73\u8861\u56e0\u5b50\u7edd\u5bf9\u503c\u5927\u4e8e1\u7684\u8282\u70b9\uff0c\u662f\u8c03\u6574\u64cd\u4f5c\u7684\u6838\u5fc3\u8282\u70b9\uff1b<\/li>\n<li>\u5931\u8861\u8282\u70b9\u7684\u76f4\u63a5\u5b50\u8282\u70b9\uff1a\u8bb0\u4e3a<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">BB<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0502em\">B<\/span><\/span><\/span><\/span><\/span>\uff0c\u5373<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">AA<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\">A<\/span><\/span><\/span><\/span><\/span>\u7684\u5de6\u5b69\u5b50\u6216\u53f3\u5b69\u5b50\uff0c\u4e14<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">BB<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0502em\">B<\/span><\/span><\/span><\/span><\/span>\u6240\u5728\u7684\u5b50\u6811\u662f\u5bfc\u81f4<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">AA<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\">A<\/span><\/span><\/span><\/span><\/span>\u5931\u8861\u7684\u201c\u504f\u9ad8\u5b50\u6811\u201d\uff1b<\/li>\n<li>\u76f4\u63a5\u5b50\u8282\u70b9\u7684\u76f4\u63a5\u5b50\u8282\u70b9\uff1a\u8bb0\u4e3a<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">CC<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0715em\">C<\/span><\/span><\/span><\/span><\/span>\uff0c\u5373<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">BB<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0502em\">B<\/span><\/span><\/span><\/span><\/span>\u7684\u5de6\u5b69\u5b50\u6216\u53f3\u5b69\u5b50\uff0c\u4e14<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">CC<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0715em\">C<\/span><\/span><\/span><\/span><\/span>\u6240\u5728\u7684\u5b50\u6811\u662f\u5bfc\u81f4<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">BB<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0502em\">B<\/span><\/span><\/span><\/span><\/span>\u7684\u5b50\u6811\u504f\u9ad8\u7684\u6838\u5fc3\u539f\u56e0\u3002<\/li>\n<\/ul>\n<p>\u57fa\u4e8e\u8fd9\u4e09\u4e2a\u8282\u70b9\u7684\u4f4d\u7f6e\u5173\u7cfb\uff0cAVL\u6811\u7684\u56db\u79cd\u5931\u8861\u7c7b\u578b\u5982\u4e0b\uff1a<\/p>\n<h5>2.2.1 \u5de6\u5de6\u578b\uff08LL\u578b\uff09<\/h5>\n<p>\u5de6\u5de6\u578b\u5931\u8861\u662f\u6700\u57fa\u7840\u3001\u6700\u7b80\u5355\u7684\u5931\u8861\u7c7b\u578b\uff0c\u5176\u6838\u5fc3\u7279\u5f81\u4e3a\uff1a<\/p>\n<li>\u5931\u8861\u8282\u70b9<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">AA<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\">A<\/span><\/span><\/span><\/span><\/span>\u7684\u5e73\u8861\u56e0\u5b50\u4e3a2\uff08\u5de6\u5b50\u6811\u9ad8\u5ea6\u6bd4\u53f3\u5b50\u6811\u9ad8\u5ea6\u59272\uff09\uff0c\u8bf4\u660e<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">AA<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\">A<\/span><\/span><\/span><\/span><\/span>\u7684\u5de6\u5b50\u6811\u504f\u9ad8\uff1b<\/li>\n<li>\u504f\u9ad8\u5b50\u6811\u7684\u6839\u8282\u70b9<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">BB<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0502em\">B<\/span><\/span><\/span><\/span><\/span>\uff08<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">AA<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\">A<\/span><\/span><\/span><\/span><\/span>\u7684\u5de6\u5b69\u5b50\uff09\u7684\u5e73\u8861\u56e0\u5b50\u4e3a1\u62160\uff08\u5de6\u5b50\u6811\u9ad8\u5ea6\u5927\u4e8e\u6216\u7b49\u4e8e\u53f3\u5b50\u6811\u9ad8\u5ea6\uff09\uff1b<\/li>\n<li>\u65b0\u8282\u70b9\u63d2\u5165\u5728<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">CC<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0715em\">C<\/span><\/span><\/span><\/span><\/span>\uff08<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">BB<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0502em\">B<\/span><\/span><\/span><\/span><\/span>\u7684\u5de6\u5b69\u5b50\uff09\u7684\u5b50\u6811\u4e2d\uff0c\u5bfc\u81f4<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">BB<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0502em\">B<\/span><\/span><\/span><\/span><\/span>\u7684\u5de6\u5b50\u6811\u9ad8\u5ea6\u8fdb\u4e00\u6b65\u589e\u52a0\uff0c\u6700\u7ec8\u4f20\u9012\u5230<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">AA<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\">A<\/span><\/span><\/span><\/span><\/span>\uff0c\u5f15\u53d1<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">AA<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\">A<\/span><\/span><\/span><\/span><\/span>\u7684\u5931\u8861\u3002<\/li>\n<p>\u7b80\u5355\u6982\u62ec\uff1a<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">AA<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\">A<\/span><\/span><\/span><\/span><\/span>\u5de6\u504f\uff0c<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">BB<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0502em\">B<\/span><\/span><\/span><\/span><\/span>\u4e5f\u5de6\u504f\uff0c\u5373\u5931\u8861\u8282\u70b9\u7684\u5de6\u5b69\u5b50\u7684\u5de6\u5b50\u6811\u504f\u9ad8\uff0c\u56e0\u6b64\u79f0\u4e3a\u5de6\u5de6\u578b\uff08LL\u578b\uff09\u3002<\/p>\n<p>\u4f8b\u5982\uff1a\u73b0\u6709\u4e00\u68f5AVL\u6811\uff0c\u8282\u70b9\u4f9d\u6b21\u4e3a3\uff08\u6839\u8282\u70b9\uff09\u30012\uff083\u7684\u5de6\u5b69\u5b50\uff09\u30011\uff082\u7684\u5de6\u5b69\u5b50\uff09\u3002\u6b64\u65f6\u82e5\u63d2\u5165\u8282\u70b90\u4f5c\u4e3a1\u7684\u5de6\u5b69\u5b50\uff0c\u8282\u70b91\u7684\u9ad8\u5ea6\u53d8\u4e3a2\uff0c\u8282\u70b92\u7684\u9ad8\u5ea6\u53d8\u4e3a3\uff0c\u8282\u70b93\u7684\u5de6\u5b50\u6811\u9ad8\u5ea6\u4e3a3\uff0c\u53f3\u5b50\u6811\u9ad8\u5ea6\u4e3a1\uff08\u7a7a\u8282\u70b9\u9ad8\u5ea6\u4e3a0\uff0c\u65e0\u53f3\u5b69\u5b50\uff09\uff0c\u5e73\u8861\u56e0\u5b50\u4e3a2\uff0c\u8282\u70b93\u6210\u4e3a\u5931\u8861\u8282\u70b9\uff0c\u4e14\u6ee1\u8db3<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">AA<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\">A<\/span><\/span><\/span><\/span><\/span>\uff083\uff09\u5de6\u504f\u3001<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">BB<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0502em\">B<\/span><\/span><\/span><\/span><\/span>\uff082\uff09\u5de6\u504f\u7684\u7279\u5f81\uff0c\u5c5e\u4e8eLL\u578b\u5931\u8861\u3002<\/p>\n<h5>2.2.2 \u53f3\u53f3\u578b\uff08RR\u578b\uff09<\/h5>\n<p>\u53f3\u53f3\u578b\u5931\u8861\u662f\u5de6\u5de6\u578b\u5931\u8861\u7684\u955c\u50cf\uff0c\u5176\u6838\u5fc3\u7279\u5f81\u4e3a\uff1a<\/p>\n<li>\u5931\u8861\u8282\u70b9<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">AA<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\">A<\/span><\/span><\/span><\/span><\/span>\u7684\u5e73\u8861\u56e0\u5b50\u4e3a-2\uff08\u53f3\u5b50\u6811\u9ad8\u5ea6\u6bd4\u5de6\u5b50\u6811\u9ad8\u5ea6\u59272\uff09\uff0c\u8bf4\u660e<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">AA<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\">A<\/span><\/span><\/span><\/span><\/span>\u7684\u53f3\u5b50\u6811\u504f\u9ad8\uff1b<\/li>\n<li>\u504f\u9ad8\u5b50\u6811\u7684\u6839\u8282\u70b9<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">BB<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0502em\">B<\/span><\/span><\/span><\/span><\/span>\uff08<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">AA<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\">A<\/span><\/span><\/span><\/span><\/span>\u7684\u53f3\u5b69\u5b50\uff09\u7684\u5e73\u8861\u56e0\u5b50\u4e3a-1\u62160\uff08\u53f3\u5b50\u6811\u9ad8\u5ea6\u5927\u4e8e\u6216\u7b49\u4e8e\u5de6\u5b50\u6811\u9ad8\u5ea6\uff09\uff1b<\/li>\n<li>\u65b0\u8282\u70b9\u63d2\u5165\u5728<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">CC<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0715em\">C<\/span><\/span><\/span><\/span><\/span>\uff08<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">BB<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0502em\">B<\/span><\/span><\/span><\/span><\/span>\u7684\u53f3\u5b69\u5b50\uff09\u7684\u5b50\u6811\u4e2d\uff0c\u5bfc\u81f4<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">BB<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0502em\">B<\/span><\/span><\/span><\/span><\/span>\u7684\u53f3\u5b50\u6811\u9ad8\u5ea6\u8fdb\u4e00\u6b65\u589e\u52a0\uff0c\u6700\u7ec8\u4f20\u9012\u5230<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">AA<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\">A<\/span><\/span><\/span><\/span><\/span>\uff0c\u5f15\u53d1<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">AA<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\">A<\/span><\/span><\/span><\/span><\/span>\u7684\u5931\u8861\u3002<\/li>\n<p>\u7b80\u5355\u6982\u62ec\uff1a<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">AA<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\">A<\/span><\/span><\/span><\/span><\/span>\u53f3\u504f\uff0c<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">BB<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0502em\">B<\/span><\/span><\/span><\/span><\/span>\u4e5f\u53f3\u504f\uff0c\u5373\u5931\u8861\u8282\u70b9\u7684\u53f3\u5b69\u5b50\u7684\u53f3\u5b50\u6811\u504f\u9ad8\uff0c\u56e0\u6b64\u79f0\u4e3a\u53f3\u53f3\u578b\uff08RR\u578b\uff09\u3002<\/p>\n<p>\u4f8b\u5982\uff1a\u73b0\u6709\u4e00\u68f5AVL\u6811\uff0c\u8282\u70b9\u4f9d\u6b21\u4e3a1\uff08\u6839\u8282\u70b9\uff09\u30012\uff081\u7684\u53f3\u5b69\u5b50\uff09\u30013\uff082\u7684\u53f3\u5b69\u5b50\uff09\u3002\u6b64\u65f6\u82e5\u63d2\u5165\u8282\u70b94\u4f5c\u4e3a3\u7684\u53f3\u5b69\u5b50\uff0c\u8282\u70b93\u7684\u9ad8\u5ea6\u53d8\u4e3a2\uff0c\u8282\u70b92\u7684\u9ad8\u5ea6\u53d8\u4e3a3\uff0c\u8282\u70b91\u7684\u53f3\u5b50\u6811\u9ad8\u5ea6\u4e3a3\uff0c\u5de6\u5b50\u6811\u9ad8\u5ea6\u4e3a1\uff0c\u5e73\u8861\u56e0\u5b50\u4e3a-2\uff0c\u8282\u70b91\u6210\u4e3a\u5931\u8861\u8282\u70b9\uff0c\u4e14\u6ee1\u8db3<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">AA<\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><\/span><\/span><\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811\uff08Balanced BST\uff09\u5168\u9762\u8be6\u89e3<br \/>\n\u4e00\u3001\u5f15\u8a00\uff1a\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u56f0\u5883\u4e0e\u5e73\u8861\u6811\u7684\u8bde\u751f<br \/>\n\u5728\u8ba1\u7b97\u673a\u79d1\u5b66\u7684\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u9886\u57df\uff0c\u4e8c\u53c9\u641c\u7d22\u6811\uff08Binary Search Tree, BST\uff09\u662f\u4e00\u79cd\u57fa\u7840\u4e14\u6838\u5fc3\u7684\u6570\u636e\u7ed3\u6784\uff0c\u5b83\u4e3a\u6570\u636e\u7684\u67e5\u627e\u3001\u63d2\u5165\u3001\u5220\u9664\u64cd\u4f5c\u63d0\u4f9b\u4e86\u4e00\u79cd\u9ad8\u6548\u7684\u7ec4\u7ec7\u65b9\u5f0f\u3002\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u6838\u5fc3\u6027\u8d28\u53ef\u4ee5\u6982\u62ec\u4e3a\u4e09\u70b9\uff1a \u5bf9\u4e8e\u4efb\u610f\u4e00\u4e2a\u8282\u70b9\uff0c\u5176\u5de6\u5b50\u6811\u4e2d\u6240\u6709\u8282\u70b9\u7684\u952e\u503c\u90fd\u5c0f\u4e8e\u8be5\u8282\u70b9\u7684\u952e\u503c\uff1b \u5bf9\u4e8e\u4efb\u610f\u4e00\u4e2a\u8282\u70b9\uff0c\u5176\u53f3\u5b50\u6811\u4e2d\u6240\u6709\u8282\u70b9\u7684\u952e\u503c\u90fd\u5927\u4e8e\u8be5\u8282\u70b9\u7684\u952e\u503c\uff1b \u5de6\u53f3\u5b50\u6811\u672c\u8eab\u4e5f\u5fc5\u987b\u662f\u4e00\u68f5\u4e8c\u53c9\u641c\u7d22\u6811\uff0c\u4e14<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1984,1813,427],"topic":[],"class_list":["post-73134","post","type-post","status-publish","format-standard","hentry","category-server","tag-1984","tag-1813","tag-427"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811\uff08Balanced BST\uff09\u5168\u9762\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/73134.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811\uff08Balanced BST\uff09\u5168\u9762\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811\uff08Balanced BST\uff09\u5168\u9762\u8be6\u89e3 \u4e00\u3001\u5f15\u8a00\uff1a\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u56f0\u5883\u4e0e\u5e73\u8861\u6811\u7684\u8bde\u751f \u5728\u8ba1\u7b97\u673a\u79d1\u5b66\u7684\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u9886\u57df\uff0c\u4e8c\u53c9\u641c\u7d22\u6811\uff08Binary Search Tree, BST\uff09\u662f\u4e00\u79cd\u57fa\u7840\u4e14\u6838\u5fc3\u7684\u6570\u636e\u7ed3\u6784\uff0c\u5b83\u4e3a\u6570\u636e\u7684\u67e5\u627e\u3001\u63d2\u5165\u3001\u5220\u9664\u64cd\u4f5c\u63d0\u4f9b\u4e86\u4e00\u79cd\u9ad8\u6548\u7684\u7ec4\u7ec7\u65b9\u5f0f\u3002\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u6838\u5fc3\u6027\u8d28\u53ef\u4ee5\u6982\u62ec\u4e3a\u4e09\u70b9\uff1a \u5bf9\u4e8e\u4efb\u610f\u4e00\u4e2a\u8282\u70b9\uff0c\u5176\u5de6\u5b50\u6811\u4e2d\u6240\u6709\u8282\u70b9\u7684\u952e\u503c\u90fd\u5c0f\u4e8e\u8be5\u8282\u70b9\u7684\u952e\u503c\uff1b \u5bf9\u4e8e\u4efb\u610f\u4e00\u4e2a\u8282\u70b9\uff0c\u5176\u53f3\u5b50\u6811\u4e2d\u6240\u6709\u8282\u70b9\u7684\u952e\u503c\u90fd\u5927\u4e8e\u8be5\u8282\u70b9\u7684\u952e\u503c\uff1b \u5de6\u53f3\u5b50\u6811\u672c\u8eab\u4e5f\u5fc5\u987b\u662f\u4e00\u68f5\u4e8c\u53c9\u641c\u7d22\u6811\uff0c\u4e14\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/73134.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-06T23:49:52+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/73134.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/73134.html\",\"name\":\"\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811\uff08Balanced BST\uff09\u5168\u9762\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-06T23:49:52+00:00\",\"dateModified\":\"2026-02-06T23:49:52+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/73134.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/73134.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/73134.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811\uff08Balanced BST\uff09\u5168\u9762\u8be6\u89e3\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811\uff08Balanced BST\uff09\u5168\u9762\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/73134.html","og_locale":"zh_CN","og_type":"article","og_title":"\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811\uff08Balanced BST\uff09\u5168\u9762\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811\uff08Balanced BST\uff09\u5168\u9762\u8be6\u89e3 \u4e00\u3001\u5f15\u8a00\uff1a\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u56f0\u5883\u4e0e\u5e73\u8861\u6811\u7684\u8bde\u751f \u5728\u8ba1\u7b97\u673a\u79d1\u5b66\u7684\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u9886\u57df\uff0c\u4e8c\u53c9\u641c\u7d22\u6811\uff08Binary Search Tree, BST\uff09\u662f\u4e00\u79cd\u57fa\u7840\u4e14\u6838\u5fc3\u7684\u6570\u636e\u7ed3\u6784\uff0c\u5b83\u4e3a\u6570\u636e\u7684\u67e5\u627e\u3001\u63d2\u5165\u3001\u5220\u9664\u64cd\u4f5c\u63d0\u4f9b\u4e86\u4e00\u79cd\u9ad8\u6548\u7684\u7ec4\u7ec7\u65b9\u5f0f\u3002\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u6838\u5fc3\u6027\u8d28\u53ef\u4ee5\u6982\u62ec\u4e3a\u4e09\u70b9\uff1a \u5bf9\u4e8e\u4efb\u610f\u4e00\u4e2a\u8282\u70b9\uff0c\u5176\u5de6\u5b50\u6811\u4e2d\u6240\u6709\u8282\u70b9\u7684\u952e\u503c\u90fd\u5c0f\u4e8e\u8be5\u8282\u70b9\u7684\u952e\u503c\uff1b \u5bf9\u4e8e\u4efb\u610f\u4e00\u4e2a\u8282\u70b9\uff0c\u5176\u53f3\u5b50\u6811\u4e2d\u6240\u6709\u8282\u70b9\u7684\u952e\u503c\u90fd\u5927\u4e8e\u8be5\u8282\u70b9\u7684\u952e\u503c\uff1b \u5de6\u53f3\u5b50\u6811\u672c\u8eab\u4e5f\u5fc5\u987b\u662f\u4e00\u68f5\u4e8c\u53c9\u641c\u7d22\u6811\uff0c\u4e14","og_url":"https:\/\/www.wsisp.com\/helps\/73134.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-06T23:49:52+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/73134.html","url":"https:\/\/www.wsisp.com\/helps\/73134.html","name":"\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811\uff08Balanced BST\uff09\u5168\u9762\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-06T23:49:52+00:00","dateModified":"2026-02-06T23:49:52+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/73134.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/73134.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/73134.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u5e73\u8861\u4e8c\u53c9\u641c\u7d22\u6811\uff08Balanced BST\uff09\u5168\u9762\u8be6\u89e3"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/73134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=73134"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/73134\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=73134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=73134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=73134"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=73134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}